apache / cordova-plugin-camera

Apache Cordova Plugin camera
https://cordova.apache.org/
Apache License 2.0
960 stars 1.52k forks source link

Duplicate Permission Error For WRITE_EXTERNAL_STORAGE #882

Closed mejainankit closed 2 months ago

mejainankit commented 2 months ago

Bug Report

Problem

Duplicate Permission Error For WRITE_EXTERNAL_STORAGE is being added in Android Manifest file

What is expected to happen?

It should not add duplicate WRITE_EXTERNAL_STORAGE

What does actually happen?

Due to minSDK check, this was creating multiple permission in Android manifest file. If you are using any other plugin, which also requires the WRITE_EXTERNAL_STORAGE

Element uses-permission#android.permission.WRITE_EXTERNAL_STORAGE at AndroidManifest.xml:20:5-108 duplicated with element declared at AndroidManifest.xml:13:5-81

Information

Command or Code

plugin.xml

Environment, Platform, Device

Android

Version information

Checklist

  • [X] I searched for existing GitHub issues
  • [X] I updated all Cordova tooling to most recent version
  • [X] I included all the necessary information above
mejainankit commented 2 months ago

This can be fixed with this PR https://github.com/apache/cordova-plugin-camera/pull/881

breautek commented 2 months ago

Details on why max SDK is included in #881 along why #881 isn't accepted.

To workaround this issue, you can use a hook to remove any duplicate entries: https://gist.github.com/breautek/bd157b8598f9a816f2ec0d45e3d932c8

I'd recommend keeping the one with the max SDK 32 declared. The gist was originally prepared for this SO Question and includes some usage examples.

mejainankit commented 2 months ago

@breautek Thanks for the update