Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My Android app suddenly requires permissions not set in AndroidManifest.xml. Why?

I have an app that have only had minor changes the last couple of years. Yesterday I released a bugfix to Google Play, and noticed that my app suddenly requires 5 new permissions:

  • android.permission.ACCESS_COARSE_LOCATION
  • android.permission.GET_ACCOUNTS
  • android.permission.READ_EXTERNAL_STORAGE maxSdkVersion=18
  • android.permission.USE_CREDENTIALS
  • android.permission.WRITE_EXTERNAL_STORAGE

I have not made any changes to AndroidManifest.xml, so these 5 permissions are not listed there.

I'm using Google's billing library (com.android.billing) for in-app purchases. This might have been automatically updated by Android Studio.

I have upgraded these libraries as well:

  • com.android.support:appcompat-v7:22.1.1 -> 22.2.0
  • com.android.support:support-v4:22.1.1 -> 22.2.0
  • com.google.android.gms:play-services:7.3.0 -> 7.5.0

Does anyone know why this happened?

UPDATE WITH ANSWER

@ahmad-nawaz is right, and his answer led me to figure this out. Here is a more detailed answer to my question:

The library that wanted the extra permissions is Google Play Services.

In Google Play Services version 6.5 and onward, you can (and probably should) define which specific API you need, instead of just importing the whole package.

In my case, I was just using play-services-analytics, so I changed this in my build.gradle

compile 'com.google.android.gms:play-services:7.5.0'

to this

compile 'com.google.android.gms:play-services-analytics:7.5.0'

After this change, all the 5 permissions mentioned in the original question disappeared.

Here is the complete list of the individual APIs of Google Play Services: https://developers.google.com/android/guides/setup#split

like image 840
Bjarte Aune Olsen Avatar asked Sep 28 '22 17:09

Bjarte Aune Olsen


1 Answers

These are coming from Libraries you used. Android studio merge the libraries permissions into app.

like image 179
Ahmad Nawaz Avatar answered Oct 13 '22 03:10

Ahmad Nawaz