【问题标题】:Android Wear - WearablePkgInstaller﹕ Package install failed returnCode -104Android Wear - WearablePkgInstaller﹕包安装失败 returnCode -104
【发布时间】:2014-07-06 15:42:54
【问题描述】:

我正在尝试让自定义表盘正常工作,但是当我将应用程序与移动 apk 打包并将签名的移动 APK 安装到我的手机上时,当磨损 apk 尝试时,我在我的 logcat 中收到以下错误消息安装到手表上

1149-1159/? E/WearablePkgInstaller﹕ Package install failed com.ptrprograms.wearcustomwatchface, returnCode -104

有谁知道我在哪里可以找到返回代码列表,以便弄清楚发生了什么?我的代码与 Android Studio 生成的基本穿戴项目的唯一区别在于清单:

wear manifest:
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

mobile manifest:
<activity
        android:name=".CustomWatchFaceActivity"
        android:label="@string/app_name"
        android:enabled="true"
        android:taskAffinity=""
        android:allowEmbedded="true"
        android:theme="@android:style/Theme.DeviceDefault.NoActionBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="com.google.android.clockwork.home.category.HOME_BACKGROUND" />
        </intent-filter>

        <meta-data
            android:name="com.google.android.clockwork.home.preview"
            android:resource="@drawable/ic_launcher"/>
    </activity>

附加信息 - 添加了 LAUNCHER 类别意图过滤器并随后安装,因此看起来现在可能需要将表盘包含在普通应用中,但有人可能也有解决方法。

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

【问题讨论】:

标签: android wear-os


【解决方案1】:

编辑下面是我的一篇新博文,它解释了 Lollipop 中的新 Watch Face API。

http://toastdroid.com/2014/12/10/developing-a-watch-face-for-android-wear-lollipop/


确保您的移动和穿戴模块具有相同的包名称,并且移动应用包含穿戴模块所需的所有权限。此外,表盘不需要 WAKE_LOCK 权限。你可以在我做的博客文章中阅读更多关于表盘开发的信息:

http://toastdroid.com/2014/07/18/developing-watchfaces-for-android-wear/

【讨论】:

  • 使用这些链接,它们有你需要的一切!
  • @MinceMan 我无法让 Android Wearable 应用程序在模拟器上运行。想知道是否需要做任何特别的事情,也就是我们是否还需要连接设备?我的印象是,只需启动模拟器即可启动 APK 并作为表盘运行。
  • 我建议实际上对表盘使用唤醒锁。它有助于在屏幕变暗的情况下进行更新
【解决方案2】:

从您的 Wear AndroidManifest.xml 文件中删除以下 2 行权限:

<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

如果您只想让您的应用成为表盘,我相信 Intent 过滤器是可选的。

这是我发现的一个手表示例应用程序,您可以查看以供参考。 https://github.com/kentarosu/AndroidWearAndLIFX

【讨论】:

【解决方案3】:

只需要在移动清单中添加权限

【讨论】:

    猜你喜欢
    • 2018-10-26
    • 1970-01-01
    • 2022-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-06
    • 1970-01-01
    • 2012-09-01
    相关资源
    最近更新 更多