Android permissions GET_ACCOUNTS and USE_CREDENTIA

2019-06-16 13:20发布

问题:

It has been quite a few months since I had time to work on my app. And today I downloaded latest Android Studio and SDK, I found a problem after I built the app.

My AndroidManifest file does NOT require any permissions on GET_ACCOUNTS or USE_CREDENTIALS, however they are shown as new added permissions when I tried to upload the app in Google Play store. I did use Google Play Games service in the game, but it was not like this before I did this update.

Does anybody know why? I Googled a while but could not find any clue..

回答1:

If you recently updated, check to see if you switched to Google Play services 7.5 with a line in your build.gradle file such as

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

Google Play services 7.5 automatically adds required permissions - when you use com.google.android.gms:play-services - that says you are using every part of Google Play services, potentially adding more permissions than you intended.

Instead, you should selectively include what APIs you use by using separate dependencies such as:

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

(Assuming you'd need Drive for Saved Games support)