【问题标题】:packaging wearable app in eclipse在 Eclipse 中打包可穿戴应用程序
【发布时间】:2023-03-08 21:54:01
【问题描述】:

我已阅读开发人员页面 (https://developer.android.com/training/wearables/apps/packaging.html) 关于包装磨损的所有帖子。

我已经逐步尝试了一切,但没有任何效果,手表上永远不会安装磨损应用程序。 APK 安装在我的手机上,但没有安装在我的手表上。它们具有相同的包名称、权限、版本代码和版本名称。 每个应用程序都运行良好!

我在eclipse中调试了本地主机:4444,(电脑和手机通过USB接口连接,蓝牙连接手机和手表)。

问题

  1. 手表上永远不会安装磨损应用程序(USB 连接智能手机,调试智能手机应用程序)

  2. 当我蓝牙调试智能手机应用程序时,出现错误。(usb 连接智能手机和穿戴连接蓝牙调试,调试智能手机应用程序)

为什么不安装我的手表应用程序?如何解决问题?我应该通过蓝牙在本地主机:4444 中调试该电话应用程序或手表应用程序吗?如果“关闭资产压缩”需要我?帮帮我!

代码

查看 manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.abced.abc"
    android:versionCode="1"
    android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="20"
    android:targetSdkVersion="20" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>"
<uses-permission android:name="android.permission.VIBRATE"/>


<application

    android:allowBackup="true"
    android:icon="@drawable/app_mark"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >



    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" 
        android:exported="true"
         android:allowEmbedded="true"
         android:taskAffinity=""
         android:theme="@android:style/Theme.DeviceDefault.Light" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
</manifest>

手机清单.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.abcde.abc"
    android:versionCode="1"
    android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>"
<uses-permission android:name="android.permission.VIBRATE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/app_mark"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <meta-data android:name="com.google.android.wearable.beta.app"
             android:resource="@xml/wear_desc"/>


    <activity
        android:name="com.abcde.abc.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

wear_desc.xml / apk 名称:abc.apk

<?xml version="1.0" encoding="utf-8"?>
<wearableApp package="com.abcde.abc">
  <versionCode>1</versionCode>
  <versionName>1.0</versionName>
  <rawPathResId>abc</rawPathResId> 
</wearableApp>

【问题讨论】:

    标签: android eclipse export packaging wear-os


    【解决方案1】:

    在众多要求中,您必须拥有完全相同的双方权限,看起来您在手机清单上忘记了android.permission.WAKE_LOCK

    您还需要在 Wear 清单中添加 &lt;uses-feature android:name="android.hardware.type.watch" /&gt;

    【讨论】:

    • 感谢您的回答,我修改了我的代码。但穿戴应用程序永远不会进入 Eclipse 调试。 (调试手机应用已执行,手表应用尚未安装)。还有其他方法吗?如果只有在play store里运行?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-25
    • 1970-01-01
    • 1970-01-01
    • 2017-06-26
    • 2014-11-11
    • 1970-01-01
    • 2017-01-03
    相关资源
    最近更新 更多