Android “不,缺少功能:WATCH”,当我尝试使用 Wear 应用程序运行我的智能手机应用程序时?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25621818/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"No, missing feature: WATCH" when I try to run my smartphone app with wear app?
提问by Maciej Ciemi?ga
I have a smartphone app with a wear app that has been packaged inside of it, similar to the first two steps of this section:
我有一个智能手机应用程序,其中包含一个 Wear 应用程序,类似于本节的前两个步骤:
https://developer.android.com/training/wearables/apps/packaging.html#Studio
https://developer.android.com/training/wearables/apps/packaging.html#Studio
I was originally told that my smartphone wasn't running an SDK large enough to support the app (my phone was using KitKat, apparently I needed API 20), so now I am using my Nexus 7 with Android L preview, and this problem has appeared:
最初有人告诉我,我的智能手机没有运行足够大的 SDK 来支持该应用程序(我的手机使用的是 KitKat,显然我需要 API 20),所以现在我使用的是带有 Android L 预览版的 Nexus 7,这个问题有出现:
I have a smartwatch emulator and tablet running, and both are connected using the adb -d forward tcp:5601 tcp:5601 trick, so I have no idea how to fix this now!
我有一个智能手表模拟器和平板电脑正在运行,两者都使用 adb -d forward tcp:5601 tcp:5601 技巧连接,所以我现在不知道如何解决这个问题!
How can I get the smartphone app to run and automatically allow the wear app to install onto the emulator?
如何让智能手机应用程序运行并自动允许穿戴应用程序安装到模拟器上?
回答by TianZeng
回答by Maciej Ciemi?ga
In your project you have two applications:
在您的项目中,您有两个应用程序:
Mobile
Wearable
Mobile
Wearable
Mobile
app should be installed on mobile device(phone/tablet) and Wearable
app should be installed on Android Wear device.
Mobile
应用程序应安装在移动设备(手机/平板电脑)上,Wearable
应用程序应安装在Android Wear 设备上。
This message No, missing feature: WATCH
means that you're trying to install Wearable
app on mobile phone - you shouldn't do that, your mobile device is not a WATCH. So once again: just launch Mobile
app on mobile and Wearable
app on Android Wear.
此消息No, missing feature: WATCH
表示您正在尝试Wearable
在手机上安装应用程序 - 您不应该这样做,您的移动设备不是手表。所以再说一遍:只需Mobile
在移动设备Wearable
上启动应用程序,然后在 Android Wear 上启动应用程序。
I was originally told that my smartphone wasn't running an SDK large enough to support the app (my phone was using KitKat, apparently I needed API 20), so now I am using my Nexus 7 with Android L preview, and this problem has appeared:
最初有人告诉我,我的智能手机没有运行足够大的 SDK 来支持该应用程序(我的手机使用的是 KitKat,显然我需要 API 20),所以现在我使用的是带有 Android L 预览版的 Nexus 7,这个问题有出现:
Only the Wearable
app should require API level 20, but Mobile
app can target any other SDK level (like 10, 14 etc.). You don't need to set higher SDK level for Mobile
app only because it supports Wearable
app.
只有Wearable
应用程序应该需要 API 级别 20,但Mobile
应用程序可以针对任何其他 SDK 级别(如 10、14 等)。您不需要为Mobile
应用程序设置更高的SDK级别,因为它支持Wearable
应用程序。
How can I get the smartphone app to run and automatically allow the wear app to install onto the emulator?
如何让智能手机应用程序运行并自动允许穿戴应用程序安装到模拟器上?
As described in the tutorial that you've linked:
如您链接的教程中所述:
If packaged properly, when users download the handheld app, the system automatically pushes the wearable app to the paired wearable.
如果打包正确,当用户下载手持应用时,系统会自动将穿戴式应用推送到配对的穿戴式设备上。
But please read the note at the top of this page:
但请阅读本页顶部的注释:
Note: This feature doesn't work when you are signing your apps with a debug key when developing. While developing, installing apps with adb install or Android Studio directly to the wearable is required.
注意:当您在开发时使用调试密钥签署应用程序时,此功能不起作用。开发时,需要通过adb install 或Android Studio 直接将应用安装到可穿戴设备上。
This means that automatically installing Wearable
app after installing Mobile
app (with Wearable
app packaged inside) will only work after signing app with your publishing certificate (and not with the debug one - as is done during standard application Launch from Android Studio/Eclipse).
这意味着Wearable
在安装Mobile
应用程序后自动安装应用程序(Wearable
应用程序打包在其中)仅在使用您的发布证书签署应用程序后才起作用(而不是使用调试证书 - 就像在从 Android Studio/Eclipse 启动标准应用程序期间所做的那样)。
回答by MikeL
I had the same error when I tried running non wearable application on my device and the error was due to some Android Studio issue with misreading the uses-featureattribute in the Manifest (it reads required false as true):
当我尝试在我的设备上运行非穿戴式应用程序时,我遇到了同样的错误,该错误是由于某些 Android Studio 问题导致误读了清单中的uses-feature属性(它读取 required false 为 true):
<uses-feature
android:name="android.hardware.type.watch"
android:required="false"/>
If you remove it from the manifest the error will disappear. I think that it should be already fixed in Android Studio 1.4.1 or 1.5.
如果您从清单中删除它,错误就会消失。我认为它应该已经在 Android Studio 1.4.1 或 1.5 中修复了。
回答by prashant
Check if you have not open any other android project. I also faced same issue which got solved after I closed android project which has target API greater than watch's.
检查您是否还没有打开任何其他 android 项目。我也遇到了同样的问题,在我关闭目标 API 大于手表的 android 项目后得到解决。