我正在尝试打包 Android Wear 应用程序,但 Wear 应用程序未自动安装在 watch 中。
我正在使用 Eclipse 手动打包 Wear 应用程序,如此处所述
https://developer.android.com/training/wearables/apps/packaging.html#PackageManually
日志还说已安装 Wear 应用程序,但我在 watch 中找不到该应用程序。这是安装日志,
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) }
会有什么错误?有什么建议么?谢谢。
注意:我使用以下命令在配套移动设备中安装应用程序
更新:
Wear 应用程序 list
<?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>
配套应用 list
<?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>
原始文件夹
wearable_app_desc.xml
<wearableApp package="com.titut.wear">
<versionCode>1</versionCode>
<versionName>1.0</versionName>
<rawPathResId>wearable_app</rawPathResId>
</wearableApp>
最佳答案
在设备中安装应用程序之前,只需检查以下内容。
1) 你的PhoneAppPackage 名称和wearApp Packagename 必须相同
2) 在 Xml 文件夹 appPathResid 和您添加的 Apk 文件名必须相同
3)您是否使用原始设备进行测试,然后只打开蓝牙调试,或者如果您使用模拟器和真实手机,则打开USB调试
就是这样...
关于Android Wear 包装不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25864925/