这是我关于堆栈溢出的第一个问题,所以请让我知道如果我应该以不同的格式。如何自动将APK从移动版穿到?
我正在写一个Android手机(手机)应用程序,它将与配套的Android Wear(手表)应用程序进行交互。当我通过adb直接安装这些应用程序时,这两个应用程序都可以工作我正在尝试创建一个APK,它将通过电子邮件附件安装到手机上,并将伴侣应用自动推送到手表上。但是,当我创建一个APK并通过电子邮件附件安装它时,此APK未成功将伴随应用程序推送到我的手表。
当我通过$ adb -d logcat | grep 1329
阅读安装日志时,得到以下结果(如下)。会有人碰巧知道我做错了什么吗?我试图在网上查找错误消息,但没有发现任何有用的东西。
D/ResourcesManager(1329): creating new AssetManager and set to /data/app/com.google.android.gm-2/base.apk
D/skia (1329): --- SkImageDecoder::Factory returned null
W/AssetUtil(1329): loadBitmapAssetFromResources: failed to decode bitmap resource for package com.google.android.gm
D/skia (1329): --- SkImageDecoder::Factory returned null
W/AssetUtil(1329): loadBitmapAssetFromResources: failed to decode bitmap resource for package com.google.android.gm
I/art (1329): Background partial concurrent mark sweep GC freed 72449(3MB) AllocSpace objects, 22(5MB) LOS objects, 40% free, 18MB/31MB, paused 1.452ms total 197.557ms
D/ResourcesManager(1329): creating new AssetManager and set to /system/priv-app/SecDownloadProvider/SecDownloadProvider.apk
W/ResourceType(1329): No package identifier when getting value for resource number 0x00000000
W/PackageManager(1329): Failure retrieving resources for com.android.providers.downloads: Resource ID #0x0
D/ResourcesManager(1329): creating new AssetManager and set to /data/app/com.slightlyrobot.motion_record_phone_and_wear-2/base.apk
I/WearablePkgInstaller(1329): Setting DataItem to install wearable apps for com.slightlyrobot.motion_record_phone_and_wear
D/ResourcesManager(1329): creating new AssetManager and set to /data/app/com.slightlyrobot.motion_record_phone_and_wear-1/base.apk
I/WearablePkgInstaller(1329): Companion package metadata matches, not requesting installs for com.slightlyrobot.motion_record_phone_and_wear
I/art (1329): Explicit concurrent mark sweep GC freed 59365(2MB) AllocSpace objects, 4(1013KB) LOS objects, 39% free, 18MB/31MB, paused 699us total 161.260ms
D/ResourcesManager(1329): creating new AssetManager and set to /data/app/com.google.android.gm-2/base.apk
D/skia (1329): --- SkImageDecoder::Factory returned null
W/AssetUtil(1329): loadBitmapAssetFromResources: failed to decode bitmap resource for package com.google.android.gm
D/skia (1329): --- SkImageDecoder::Factory returned null
W/AssetUtil(1329): loadBitmapAssetFromResources: failed to decode bitmap resource for package com.google.android.gm
D/ResourcesManager(1329): creating new AssetManager and set to /system/priv-app/SecDownloadProvider/SecDownloadProvider.apk
W/ResourcesManager(1329): Asset path '/system/framework/secsmartcard.jar' does not exist or contains no resources.
W/ResourceType(1329): No package identifier when getting value for resource number 0x00000000
W/PackageManager(1329): Failure retrieving resources for com.android.providers.downloads: Resource ID #0x0
W/ResourceType(1329): No package identifier when getting value for resource number 0x00000000
W/PackageManager(1329): Failure retrieving resources for com.android.providers.downloads: Resource ID #0x0
W/ResourceType(1329): No package identifier when getting value for resource number 0x00000000
W/PackageManager(1329): Failure retrieving resources for com.android.providers.downloads: Resource ID #0x0
D/ResourcesManager(1329): creating new AssetManager and set to /data/app/com.slightlyrobot.motion_record_phone_and_wear-2/base.apk
I/WearablePkgInstaller(1329): Setting DataItem to install wearable apps for com.slightlyrobot.motion_record_phone_and_wear
还有的W/StreamManager(1329): Dropping non-bitmap icon from notification.
许多,许多线通过输出间隔开。为清楚起见,我已将其删除。
注意
- 我使用的命令行工具包SDK,并与在Android developer's webpage和“签署您的应用程序”的“包手动”的指示签署accordanace应用。
- 我目前使用的是Android SDK命令行工具包,但愿意在必要时使用Android Studio。
- 硬件:我在三星Galaxy S5和系统的Asus ZenWatch 2.
- 测试这个我改名磨损APK从“穿的释放 - unsigned.apk”到“wear_release_unsigned.apk”当我把它放在移动应用程序的
/res/raw/
目录。与名称相反,它实际上是签名的。 - Original source code在github上可用。
非常感谢大家。
更新
我已经碰到手机上的版本和磨损的应用程序。日志如下。就像上次一样,这些都是1329. grep'ed我也删除了“丢弃非位图”行。
D/ResourcesManager(1329): creating new AssetManager and set to /system/priv-app/SecDownloadProvider/SecDownloadProvider.apk
W/ResourcesManager(1329): Asset path '/system/framework/secsmartcard.jar' does not exist or contains no resources.
I/art (1329): Explicit concurrent mark sweep GC freed 45349(2MB) AllocSpace objects, 3(304KB) LOS objects, 39% free, 18MB/31MB, paused 869us total 143.177ms
D/ResourcesManager(1329): creating new AssetManager and set to /system/framework/framework-res.apk
W/asset (1329): Asset path /system/framework/com.ipsec.client.jar is neither a directory nor file (type=1).
W/ResourcesManager(1329): Asset path '/system/framework/com.ipsec.client.jar' does not exist or contains no resources.
D/ResourcesManager(1329): creating new AssetManager and set to /system/priv-app/SecDownloadProvider/SecDownloadProvider.apk
W/ResourcesManager(1329): Asset path '/system/framework/secsmartcard.jar' does not exist or contains no resources.
W/ResourceType(1329): No package identifier when getting value for resource number 0x00000000
W/PackageManager(1329): Failure retrieving resources for com.android.providers.downloads: Resource ID #0x0
如果你的调试版本(你已直接使用亚行以前安装的)仍然在你的手表,请删除第一。我没有在日志中看到名称“wear-release-unsigned”或“wear_release_unsigned”,但请参阅“com.slightlyrobot.motion_record_phone_and_wear”,是您的吗?此外,你可以打开你的APK,并确保你的穿apk安装在那里吗? –
我已经使用adb删除了以前的调试版本。 “com.slightlyrobot。motion_record_phone_and_wear“是我为穿戴和移动应用程序使用的软件包名称(是你应该怎么做的?)。你如何检查APK的内容? – qelzin
是的,软件包名称应该完全匹配,应该使用完全相同的密钥进行签名。APK基本上是一个zip文件,因此只需使用您已有的实用工具解压即可。 –