SocialSharing-PhoneGap-Plugin: Duplicate issue

Hey there, due to this commit my android build fails due to a duplicate <uses-permission>.

When I install the file-transfer plugin it adds this line to my AndroidManifest.xml. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

When I install the SocialSharing plugin it adds this line to my AndroidManifest.xml file. <uses-permission android:maxSdkVersion="18" android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

When I run cordova build android I get this error.

:processDebugManifest/Users/Comfy-Blitz/Development/Unbill/mobile/platforms/android/AndroidManifest.xml:33:9 Error:
    Element activity#com.facebook.LoginActivity at AndroidManifest.xml:33:9 duplicated with element declared at AndroidManifest.xml:21:9
/Users/Comfy-Blitz/Development/Unbill/mobile/platforms/android/AndroidManifest.xml:37:5 Error:
    Element uses-permission#android.permission.WRITE_EXTERNAL_STORAGE at AndroidManifest.xml:37:5 duplicated with element declared at AndroidManifest.xml:36:5
/Users/Comfy-Blitz/Development/Unbill/mobile/platforms/android/AndroidManifest.xml:0:0 Error:
    Validation failed, exiting
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

So it looks like this plugin and file transfer plugin are fighting 😃 Any help here?

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Comments: 22 (5 by maintainers)

Commits related to this issue

Most upvoted comments

For Cordova 5.4.x manually change the file platforms/android/android.json (find all extra ā€œandroid.permission.WRITE_EXTERNAL_STORAGEā€ and delete them) and rebuild app.

After scratching my head over this for 2 days, I finally switched to this plugin and things have worked well since then. cordova plugin add phonegap-plugin-barcodescanner Details: https://www.sitepoint.com/scanning-qr-code-cordova/ Note: cordova-plugin-barcodescanner kept giving errors in Android, but phonegap-plugin-barcodescanner worked.

Hey @ashishgupta301, it’s pretty annoying but you have to open your plugins/android.json and remove the duplicate keys in there. In your case, search for WRITE_EXTERNAL_STORAGE in android.json and remove any duplicates. Then open up platforms/android/AndroidManifest.xml and remove any duplicate <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />. Then rebuild and try again.