为什么Google Play商店要求不在我的清单中的权限?

时间:2015-07-23 08:50:18

标签: android google-maps permissions

我认为这可能与ManifestMerger有关。

我的AndroidManifest.xml权限:

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

然而该应用程序要求:

Identity Location Photos/Media/Files

manifest-merger-release.txt说:

uses-permission#android.permission.WRITE_EXTERNAL_STORAGE
ADDED from com.google.android.gms:play-services-maps:7.5.0:22:5
uses-permission#android.permission.ACCESS_COARSE_LOCATION
ADDED from com.google.android.gms:play-services-maps:7.5.0:23:5
android:uses-permission#android.permission.READ_EXTERNAL_STORAGE
IMPLIED from AndroidManifest.xml:2:1 reason: com.google.android.gms.maps requested WRITE_EXTERNAL_STORAGE
uses-permission#android.permission.GET_ACCOUNTS
ADDED from com.google.android.gms:play-services-wallet:7.5.0:21:5
    android:name
        ADDED from com.google.android.gms:play-services-wallet:7.5.0:21:22
uses-permission#android.permission.USE_CREDENTIALS
ADDED from com.google.android.gms:play-services-wallet:7.5.0:22:5
    android:name
        ADDED from com.google.android.gms:play-services-wallet:7.5.0:22:22

但我的应用程序没有使用谷歌地图等...

更新

build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    defaultConfig {
        ...
    }
    signingConfigs {
        release {
            ...
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
}

repositories {
    maven { url "https://jitpack.io" }
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'com.github.PhilJay:MPAndroidChart:034e05997d'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile('com.crashlytics.sdk.android:crashlytics:2.2.3@aar') {
        transitive = true;
    }
    compile 'com.squareup.okhttp:okhttp:2.3.0'
    compile 'com.jakewharton:butterknife:6.1.0'
}

1 个答案:

答案 0 :(得分:2)

您可以将build.gradle中的compile 'com.google.android.gms:play-services:7.5.0'更改为您需要的播放服务的特定部分。

查看https://developers.google.com/android/guides/setup

通过这种方式,播放服务不会添加不需要的权限

示例:

要使用Google Cloud Messaging,只需使用com.google.android.gms:play-services-gcm:7.5.0

即可