More Permissions in uploaded apk than in manifest

2020-02-13 13:30发布

问题:

I wanted to update my app but after uploading I noticed that there were additional permissions which I don't mention in my manifest:

android.permission.ACCESS_NETWORK_STATE
android.permission.GET_ACCOUNTS
android.permission.INTERNET
android.permission.READ_EXTERNAL_STORAGE
android.permission.USE_CREDENTIALS
android.permission.WRITE_EXTERNAL_STORAGE
com.google.android.c2dm.permission.RECEIVE

My manifest looks like this

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.stepscience.yahtzee" >

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

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.App" >
    <meta-data
        android:name="com.google.android.gms.games.APP_ID"
        android:value="@string/app_id" />

    <activity
        android:name=".StartActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent" />


</application>

I only use the permissions for Internet and Network access. Where do the other permissions come from? In the app I use also some google play services like multiplayer and leaderboards. The only changes that I made to the version before were some version updates (gradle,play-services,appcompat) and some xml modifications.

回答1:

Some permissions are being added by Google Play Services.

You can reduce the permissions it adds by only including the components that you actually need. e.g Google Cast, Google Drive etc

See here for how to do that: https://developers.google.com/android/guides/setup

Example gradle:

Entire Play Services

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

Only Games Services

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