Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Figure out who is adding READ_PHONE_STATE to my manifest file?

Tags:

android

I am compiling a project that does not explicitly request the READ_PHONE_STATE permission, but when I compile I am seeing the permission in my compiled Android Manifest file. I'm assuming some library that's being pulled in is adding it explicitly or forgot to set its minimum SDK version (which would add it).

The only thing I have to go on is that in the final manifest, the permissions I requested myself look like this:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

And the READ_PHONE_STATE looks like this:

<android:uses-permission android:name="android.permission.READ_PHONE_STATE" />

Does the android prefix mean anything?

Is there any way to narrow down which library is adding this permission?

like image 908
Mark Avatar asked Sep 12 '25 04:09

Mark


1 Answers

You can exactly see if a (or because of) library adds some extra Permission to your manifest. Check at file generated (see below) during build process and look for the unwanted permission within the file!

Go to your project folder and look for this path:

[ProjectFolder]/build/outputs/logs/manifest-merger---report.txt

open the file and search for the permission In my case I found these lines at the

 uses-permission#android.permission.READ_PHONE_STATE IMPLIED from
 C:\..\...\AppFolder\src\..\AndroidManifest.xml:2:1-14:12 reason:
 com.some.evil.library has a targetSdkVersion < 4

This generated file show the output of the merge process described here in Android Developers site.

like image 93
Tano Avatar answered Sep 14 '25 17:09

Tano