无法在 Wear 上安装我的应用程序

Can't install my app on wear

我尝试为我现有的应用程序添加一个磨损模块,尝试了很多解决方案,但无法弄清楚为什么我的应用程序没有安装到我的手表上。

我尝试了什么:

首先,手动打包我的应用程序:https://developer.android.com/training/wearables/apps/packaging.html

但我很快决定不经历这个。

然后我决定去gradle include,所以对于app的build.gradle,我在dependencies的末尾添加了以下内容:

debugWearApp project(path:':wear', configuration: 'flavor1Debug')
releaseWearApp project(path:':wear', configuration: 'flavor1Release')

为了wear的build.gradle,我在dependencies的开头添加了以下内容:

wearApp project(':wear')

然后,在 android{} 部分磨损 build.gradle,就在 buildToolsVersion 之后,我添加了以下内容:

publishNonDefault true

我所看到的:

然后,当我安装我的应用程序的生成发布版本时,我可以在原始文件中看到它已添加一个文件 android_wear_micro_apk.apk 到 res/raw 这是我的手表应用程序。 我还在 res/xml 中看到了一个文件 android_wear_micro_apk.xml,根据我猜测的六进制代码,其中包含磨损应用程序的描述。

然后我比较签名:

keytool -list -printcert -jarfile mobile_app.apk
keytool -list -printcert -jarfile wear_app.apk

使用res/raw中生成的穿戴应用。它们具有完全相同的签名。然后我比较了:

aapt dump badging mobile_app.apk
aapt dump badging wear_app.apk

它们具有完全相同的包名称和版本代码和名称。

所以,从那个:

我真的很想知道我可能忘记了什么。

感谢您的帮助

您可能需要检查应用中声明的权限。正如 Requesting Permissions on Android Wear 中提到的关于可穿戴设备和手机应用程序之间不匹配的权限模型,

If your handset app begins using the Android 6.0 (API level 23) model but your wearable app does not, the system downloads the Wear app, but does not install it. The first time the user launches the app, the system prompts them to grant all pending permissions. Once they do so, it installs the app. If your app, for example a watch face, does not have a launcher, the system displays a stream notification asking the user to grant the permissions the app needs.

这些 SO 帖子中建议的解决方案也可能有帮助:

  • Android Wear App not installed
  • Android Wear app not installing through handset

根据 Google 的一位 Android 开发者倡导者的说法,Android Wear 2.0 将需要完全独立的手表和 phone 应用程序,并放弃自那时以来使用的系统Android Wear 的第一个版本会根据您 phone 上的应用程序自动安装 Android Wear 应用程序。 他在 Android Wear Developers Google+ 社区(强调我们的)中对另一位开发人员的回复直言不讳:

A Wear 2.0 user must visit the Play Store on their watch to install apps. There is no auto-install like on Wear 1.X. Wear 2.0 apps get full network access and can be installed completely separately from the handheld app so the focus is much more on standalone Wear apps than the handheld centric 1.X Wear apps.

But what about apps built solely for your watch? Well, there's a whole store worth of apps that go beyond simple notifications and live on the watch itself. Rather oddly, these still have to be installed through your smartphone. For now, at least - the new Android Wear 2.0 update will include functionality for standalone apps.

Forum

在手表上:

  • 设置,Un-pair 和 phone。 (AW 的旧版本可能会说 Factory 重置。)

  • 暂时不要设置手表。

在 phone:

  • 在 Android 中使用 Disconnect... 选项。

  • 在Android佩戴,使用设置,设备设置,触摸手表 名称,触摸忘记手表。

  • 设置,蓝牙。如果您仍然看到手表,请触摸忘记... 注意它不再出现在配对设备列表中。

  • 设置,设备,应用,select Google Play 服务。清除缓存和 清除数据。卸载更新。

  • 设置,设备,应用程序,select Google 应用程序。清除缓存并清除 数据。同时卸载更新。

  • 设置,设备,应用程序,select Android 佩戴。清除缓存并清除 数据。同时卸载更新。

  • Play 商店、应用程序、我的应用程序,触摸全部更新按钮。