【问题标题】:Android Wear app says it requires permissions that aren't in my manifestAndroid Wear 应用说它需要我的清单中没有的权限
【发布时间】:2015-10-27 05:33:08
【问题描述】:

我正在制作一个我计划很快发布的表盘,但是当移动端安装时我无法安装可穿戴组件(有点重要:p)。这是我在运行 Android Marshmallow 的 Nexus 5X 上安装带有嵌入式可穿戴 apk 的签名 apk 时正在测试的手表的堆栈跟踪的一部分:

10-13 20:43:50.293    2279-8109/? I/PkgMgrInstallUtil﹕ Sending install intent to PackageInstaller Intent { act=android.intent.action.INSTALL_PACKAGE dat=content://com.google.android.clockwork.home.provider/host/com.twintitanium.watchfaces.cardswatchface/wearable/com.twintitanium.watchfaces.cardswatchface/apk typ=vnd.android.cursor.item/wearable_apk cmp=com.android.packageinstaller/.wear.WearPackageInstallerService (has extras) } forcom.twintitanium.watchfaces.cardswatchface
10-13 20:43:51.168    7981-8110/? W/WearPkgInstallerService﹕ Wearable com.twintitanium.watchfaces.cardswatchface has a permission "android.permission.WRITE_EXTERNAL_STORAGE" that is not granted in the host application.
10-13 20:43:51.168    7981-8110/? W/WearPkgInstallerService﹕ Wearable com.twintitanium.watchfaces.cardswatchface has a permission "android.permission.READ_EXTERNAL_STORAGE" that is not granted in the host application.
10-13 20:43:51.168    7981-8110/? W/WearPkgInstallerService﹕ Wearable com.twintitanium.watchfaces.cardswatchface has a permission "android.permission.GET_ACCOUNTS" that is not granted in the host application.

确实,如果我在设置下转到手机上已安装的应用程序(卡片表盘),我会看到 2 个权限,即联系人和存储,被禁用。

似乎不言自明,除了我的可穿戴清单中没有任何这些权限 - 我只有“com.google.android.permission.PROVIDE_BACKGROUND”和“android.permission.WAKE_LOCK”,因为它们表盘是必需的。如果我尝试将这些权限添加到我的移动设备和可穿戴设备清单中,它仍然会出现相同的错误。

这是一个新问题,因为我在 Play 商店中有一个可以运行的 beta 版本,但后来我更新到 API 23。这可能是什么原因造成的?

【问题讨论】:

    标签: android wear-os android-permissions android-6.0-marshmallow


    【解决方案1】:

    检查您的 build.gradle 文件:如果您依赖于 'com.google.android.gms:play-services:8.1.0',它显然会从 Google Play Services 7.5 开始隐式添加权限(在本例中为联系人和存储)。将该依赖项更改为特定组件 'com.google.android.gms:play-services-wearable:8.1.0' 将摆脱这些权限(并使您的 apk 更小,因为它不包含它不使用的库)。

    【讨论】:

      猜你喜欢
      • 2019-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-20
      • 2018-07-17
      相关资源
      最近更新 更多