Android穿包装不起作用

时间:2014-09-16 09:15:50

标签: android eclipse apk wear-os

我试图打包安装Android应用程序但是戴上的应用程序并没有自动安装在手表中。

我正在使用Eclipse手动打包磨损应用程序,如此处所述

https://developer.android.com/training/wearables/apps/packaging.html#PackageManually

日志也说安装了磨损的应用程序,但我无法在手表中找到该应用程序。这是安装日志,

09-16 12:55:08.135: D/Finsky(11998): [1] WorkerTask.onPreExecute: Verification Requested for id = 4, data=file:///storage/emulated/0/Download/WearCompanion.apk flags=16 fromVerificationActivity=false
09-16 12:55:13.955: D/PackageManager(2339): Sending to user 0: act=android.intent.action.PACKAGE_ADDED dat=package:com.titut.wear flg=0x8000000 Bundle[{android.intent.extra.UID=10013, android.intent.extra.user_handle=0}]
09-16 12:55:14.160: I/HomeSyncInstallReceiver(2711): Package Added : com.titut.wear
09-16 12:55:14.930: D/BackupManagerService(2339): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.titut.wear flg=0x8000010 (has extras) }
09-16 12:55:14.950: D/ECS_EnterpriseContainerService(2339): <<< Intent data is   >>> : package:com.titut.wear
09-16 12:55:14.975: D/[FileShare][Server](12291): ServerBroadcastReceiver : onReceive: android.intent.action.PACKAGE_ADDED // package:com.titut.wear
09-16 12:55:15.130: I/SmartCardBroadcastReceiver(11980): foundMatchingVendorPackage - Checking for com.titut.wear
09-16 12:55:15.195: I/CrashAnrDetector(2339): onPackageAdded : com.titut.wear
09-16 12:55:15.320: D/PackageBroadcastService(6283): Received broadcast action=android.intent.action.PACKAGE_ADDED and uri=com.titut.wear
09-16 12:55:15.365: I/IcingCorporaProvider(3480): Updating corpora: APPS=com.titut.wear, CONTACTS=MAYBE
09-16 12:55:15.400: D/WearablePkgInstaller(3243): Got PackageUpdateReceiver message Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.titut.wear flg=0x8000010 cmp=com.google.android.wearable.app/com.google.android.clockwork.companion.packagemanager.PackageUpdateReceiver (has extras) }

错误是什么?有什么建议?感谢。

注意:我使用以下命令在随播移动设备中安装应用程序

  

adb install WearCompanion.apk

更新:

穿app app Manifest

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

    <uses-feature android:name="android.hardware.type.watch" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <uses-sdk
        android:minSdkVersion="20"
        android:targetSdkVersion="20" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.DeviceDefault" >
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity
            android:name="com.titut.wear.LoadingActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.titut.wear.MainActivity"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="com.titut.wear.OfferDetailActivity"
            android:label="@string/app_name" >
        </activity>

        <service android:name="com.titut.wear.OngoingNotificationListenerService" >
            <intent-filter>
                <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
            </intent-filter>
        </service>
    </application>

</manifest>

Companion App Manifest

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

    <uses-sdk
        android:minSdkVersion="17"
        android:targetSdkVersion="20" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <uses-feature
        android:name="android.hardware.type.watch"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.bluetooth_le"
        android:required="true" />

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

        <activity
            android:name="com.titut.companion.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>

        <service android:name="com.titut.companion.service.MessageListenerService" >
            <intent-filter>
                <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
            </intent-filter>
        </service>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.wearable.beta.app"
            android:resource="@xml/wearable_app_desc" />

        <service
            android:name="com.titut.companion.service.BeaconService"
            android:enabled="true" />
    </application>

</manifest>

原始文件夹

enter image description here

wearable_app_desc.xml

<wearableApp package="com.titut.wear">
  <versionCode>1</versionCode>
  <versionName>1.0</versionName>
  <rawPathResId>wearable_app</rawPathResId> 
</wearableApp>

3 个答案:

答案 0 :(得分:0)

在设备中安装应用之前只需检查下面的内容。

1)您的PhoneAppPackage名称和wearApp包名称必须相同

2)在Xml文件夹appPathResid中,您添加的Apk文件名必须相同

3)您是否使用原始设备进行测试然后只打开蓝牙调试或者如果您使用模拟器和真实手机然后进行USB调试

多数民众赞成......

答案 1 :(得分:0)

使用调试密钥签名时,应用 NOT 会自动推送到设备。 您需要通过使用Eclipse调试手动将安装推送到设备,或者使用发布密钥对移动APK进行签名:

  

注意:可穿戴应用的自动安装不起作用   您正在使用调试密钥签署应用程序,并且仅适用于发布   键。见Packaging Wearable Apps   有关如何正确打包可穿戴应用程序的完整信息。

此处有更多详情:https://developer.android.com/training/wearables/apps/creating.html#Install

答案 2 :(得分:0)

移动/随播应用中的权限必须与佩戴应用中的权限相同。在您的穿着清单中只有一个许可,但在移动清单中有五个。将移动清单权限复制到磨损清单。