Build Error... :app:processDebugMainManifest

Apparently there are two instances of WRITE_EXTERNAL_STORAGE but certainly not any permission I’m requesting as this is just an app where I experiment with new features or plugins.

I do have:

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity">
      <application android:exported="true" />

The relevant error is:

> Task :app:processDebugMainManifest FAILED
/platforms/android/app/src/main/AndroidManifest.xml:86:5-108 Error:
	Element uses-permission#android.permission.WRITE_EXTERNAL_STORAGE at AndroidManifest.xml:86:5-108 duplicated with element declared at AndroidManifest.xml:75:5-81
/platforms/android/app/src/main/AndroidManifest.xml Error:
	Validation failed, exiting

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.

I’ve updated all my plugins, searched the forums and found where others have migrated to different branches that work and changed those, commented out ones that reportedly cause conflicts but aren’t needed for this build.

Now what? How can I track this down?

We’ve seen this before. You’ve got two plugins both adding this permission. The best practice is to leave this to the app writer to handle, rather than the having a plugin do it - but many plugins try to be helpful and end up causing this issue.

Do you have a list of plugins you’re using?

I have an app called TestTube that I used for testing new features and goofing around… I’ve not been in it since sometime early last year (sad reason), now back at it. Things get added, commented out etc. here’s everything that’s in it that’s not commented out!

  <plugin name="cordova-plugin-androidx-adapter" spec="1.1.3" />
  <plugin name="cordova-plugin-splashscreen" spec="6.0.2" />
  <plugin name="cordova-plugin-statusbar" spec="4.0.0" />
  <plugin name="cordova-plugin-device" spec="2.1.0" />
  <plugin name="cordova-plugin-email-composer" source="npm" spec="0.10.1" />
  <plugin name="cordova-plugin-compat" spec="1.2.0" />
  <plugin name="cordova.plugins.diagnostic" spec="7.1.4" />
  <plugin name="cordova-plugin-inappbrowser" spec="6.0.0" />
  <plugin name="cordova-sqlite-storage" spec="6.1.0" />
  <plugin name="cordova-plugin-network-information" spec="3.0.0" />
  <plugin name="cordova-open-native-settings" spec="1.5.5" />
  <plugin name="@ayushmw/cordova-plugin-x-socialsharing" spec="6.0.4" />
  <plugin name="@havesource/cordova-plugin-push" spec="4.0.0">
    <variable name="SENDER_ID" value="xxxxxxxx" />
    <variable name="FCM_VERSION" value="18.+" />
  <plugin name="cordova-plugin-geolocation" spec="5.0.0">
    <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="TestTube uses geolocation to determine where you are." />
  <plugin name="cordova-plugin-fingerprint-aio" spec="5.0.1" />
  <plugin name="@ahovakimyan/cordova-plugin-wkwebviewxhrfix" spec="1.0.2" />

As an FYI, I took the social sharing plugin out… same problem.
I’d also already checked the open issues and did a search on WRITE_EXTERNAL_STORAGE with the following plugins:

@ahovakimyan/cordova-plugin-wkwebviewxhrfix **
cordova-plugin-inappbrowser (Open PR from 2017, not in code)
cordova.plugins.diagnostic (5 references in code, 6 older issues, 3 from 2023)
cordova-plugin-compat (commented out for next try)
cordova-plugin-email-composer *** (not updated in 2 years, works on iOS)

** Might be one source of conflict but issues looked like a user err in the angular.json.
*** WRITE_EXTERNAL_STORAGE was found in issues from 2014/15 but was not found in \<code>

So, essentially, only one plugin currently in use is applying those permissions.

Here’s where I ended up on this.

I removed cordova-plugin-diagnostics and built. I then got a kotlin err from
@havesource/cordova-plugin-push (which I reported).

Next, I removed @havesource/cordova-plugin-push and got a build (it didn’t function but it did build!).

Then, I added the cordova-plugin-diagnostic back in and it built AND it ran.

It seems like the WRITE_EXTERNAL_STORAGE is a phantom error that is being produced by something else.

This seems strange - are you able to consistently reproduce the original error?

Nope. After removing first cordova-plugin-diagnostics and getting the kotlin error from cordova-plugin-push

serError: FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
See log for full details. 

And then removing the cordova-plugin-push and getting a build with no errors I then added the diagnostics plugin back in to the project and it built just fine.

I did open a ticket on the @havesource/cordova-plugin-push… it appears there are a number of issues that have yet to be addressed.

BTW, the above kotlin error is from having both the diagnostic and push plugins in the project at the same time. Is it possible y’all had an older version of the diagnostic plugin cached?

We do cache NPM packages, but generally only for a period of minutes at most.

A few questions:

  1. Does your config.xml match exactly what it did before, or did the plugin order (or something else) change?
  2. Are you using the iOS or Android beta?

Android Beta
Config file WAS in the exact order with only those changes as noted above.

I have two other projects to update so I’m certain we’ll have an opportunity to revisit this.

Android beta has changed very recently. If you’ve been using it consistently, you were definitely using an older build system/deps from our last beta. As it turns out we’re now running a new (yet to be announced) beta, so if you’re seeing inconsistencies, that could be why.

1 Like