为什么我的应用程序说我正在请求联系人权限?

Why does my app say I am requesting permission for Contacts?

我有一个表盘应用程序说我正在请求通讯录权限...但我没有。我不明白这是为什么...

我有应用内结算,我访问 Google 健身数据...以及 Google 分析。

这是我的清单中的权限列表:

<!-- Normal Permissions -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="com.android.vending.BILLING" />

    <!-- Dangerous Permissions -->
    <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_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <!-- Permissions required by the wearable app -->
    <uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

以下是来自 Play 商店的此应用程序权限列表:

In-app purchases
Identity
find accounts on the device
Contacts
find accounts on the device
Location
precise location (GPS and network-based)
approximate location (network-based)
Photos/Media/Files
modify or delete the contents of your USB storage
read the contents of your USB storage
Storage
modify or delete the contents of your USB storage
read the contents of your USB storage
Other
receive data from Internet
full network access
view network connections
run at startup
prevent device from sleeping
use accounts on the device

应用依赖项:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    wearApp project(':Wearable')
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.support:wearable:1.3.0'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
    compile files('libs/httpclient-4.5.1.jar')
    compile files('libs/apache-httpcomponents-httpclient.jar')
    compile files('libs/apache-httpcomponents-httpclient-cache.jar')
    compile files('libs/apache-httpcomponents-httpcore.jar')
    compile files('libs/apache-httpcomponents-httpmime.jar')
    compile files('libs/GoogleConversionTrackingSdk-2.2.4.jar')
    compile files('libs/feedback_v6.jar')
}

穿着依赖:

dependencies {
    compile 'com.google.android.support:wearable:1.3.0'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.android.support:support-v13:23.1.0'
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
}

在我的一个应用程序中,我遇到了一个问题,我的应用程序要求获得我从未要求过的权限,结果证明是 Google 播放服务。

我们必须明确提及我们的应用需要 Google 播放服务的哪一部分。例如,如果我们需要广告,我们需要使用

com.google.android.gms:play-services-ads:8.4.0

而不是

com.google.android.gms:play-services:8.4.0

接下来会发生什么 Google play services 会请求其提供的所有服务的许可,即使我们的应用程序不需要相同的许可。

请检查,https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project,只使用你需要的,看看是否能解决你的问题。

在你的情况下,我怀疑 Google 帐户登录是联系的原因。

希望这对您有所帮助。祝一切顺利。

@Natarajan Raman 的好建议!!我只想补充一点,@CommonsWare 有一篇很棒的文章,Hey, Where Did These Permissions Come From? 解释了这个问题。

引用文章:

It is possible that you will find yourself in a situation where you want a dependency but you don’t want the permissions that the dependency wants. You can try to block the permission from the merger process, by having a element in your own manifest (e.g., in the main sourceset) with tools:node="remove":

因此,如果您只遇到联系人权限方面的问题,您可以在您的清单中添加:

 <uses-permission android:name="android.permission.READ_CONTACTS" tools:node="remove" />

不需要的权限将被删除。

希望对您有所帮助!!!

已修复!!!

将依赖项更改为:

    compile 'com.google.android.gms:play-services-fitness:8.3.0'
    compile 'com.google.android.gms:play-services-wearable:8.3.0'
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
    compile 'com.google.android.gms:play-services-appindexing:8.3.0'

而不是:

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

奖励:还使我的应用程序变得更小!!