15

One of my projects has multiple third party libraries and one of those libraries is requesting a permission that I don't have defined in my Manifest. How can I find out which of the libraries is requesting the permission?

If I perform the command:

adb shell dumpsys package [mypackagename]

then I see the permission as "requested", but as I mentioned it doesn't exist in my project. There are a lot of third party libraries.

Jon
  • 7,941
  • 9
  • 53
  • 105
  • 1
    https://stackoverflow.com/questions/30546197/android-studio-adds-unwanted-permission-after-running-application-on-real-device – CommonsWare Sep 06 '16 at 16:05

1 Answers1

35

you can find your final permission in merged manifest file at

app/build/intermediates/manifests/full/debug/AndroidManifest.xml

You can get rid of this with

Just declare the incriminated permission in your main Manifest with the tools:node="remove"

like:

<uses-permission android:name=”android.permission.RECORD_AUDIO” tools:node=”remove” />

Even if another third party library is asking for this specific permission, the build will be forced to not merge it in your final Manifest file.

Dharmaraj
  • 1,256
  • 13
  • 12
  • 2
    Thanks. Is there a way of knowing which library is asking for the permission? It would help me to investigate whether it was really necessary for them and in testing to make sure the app still worked properly – Jon Sep 06 '16 at 16:00
  • 18
    app/build/outputs/logs/manifest-merger-debug-report.txt here you can find the required info...if you got your answer please up vote:) – Dharmaraj Sep 06 '16 at 16:02
  • 1
    to view this files you need to select project view in android studio – Dharmaraj Sep 06 '16 at 16:04
  • 1
    To view the merged manifest files you can also go to your Android Manifest and choose `Merged Manifest` at the bottom – oyeraghib Dec 30 '22 at 13:03
  • If you are still having problems: I had to declare the tag from above inside both `manifest` and `application` to make all occurrences vanish. Yes, I placed the same line twice inside the `AndroidManifest.xml`. – Malte Peters Jul 20 '23 at 16:22