我刚刚敲了第一个应用程序,已经发布并签名并转移到我的手机上,但无法将其安装到我的手机上 - 在浏览屏幕后说“你想要安装此应用程序”和点击安装,我只收到一条消息,说“应用程序没有安装”,没有进一步说明。我使用jarsigner -verify
检查了签名。
我已将.apk上传到http://ubuntuone.com/p/ESB/并使用手机上的LogCollector应用程序获取日志。相关摘录转载如下。
Log Collector version: 1.1.0
Device model: HTC Desire
Firmware version: 2.2
Kernel version: 2.6.32.15-gf9c0527
htc-kernel@and18-2 )
#1 PREEMPT Fri Jul 23 17:26:53 CST 2010
Build number: FRF91
08-31 10:18:21.289 I/ActivityManager( 93): Starting activity: Intent { act=android.intent.action.VIEW dat=file:///sdcard/blanket.apk typ=application/vnd.android.package-archive cmp=com.android.packageinstaller/.PackageInstallerActivity }
08-31 10:18:21.359 I/PackageParser(20453): uk.co.oketchup.blanketsquare: compat added android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE
08-31 10:18:21.379 D/skia (20453): --- decoder->decode returned false
08-31 10:18:21.669 I/ActivityManager( 93): Displayed activity com.android.packageinstaller/.PackageInstallerActivity: 331 ms (total 331 ms)
08-31 10:18:22.059 D/PowerManagerService( 93): New lightsensor value:640, lcdValue:192
08-31 10:18:22.390 D/SynchronizationService(20285): Checking preferences
08-31 10:18:22.769 I/ActivityManager( 93): Starting activity: Intent { dat=file:///sdcard/blanket.apk cmp=com.android.packageinstaller/.InstallAppProgress (has extras) }
08-31 10:18:22.849 D/skia (20453): --- decoder->decode returned false
08-31 10:18:22.999 D/dalvikvm(20459): GC_EXPLICIT freed 419 objects / 23968 bytes in 74ms
08-31 10:18:23.089 D/PackageParser( 93): Scanning package: /data/app/vmdl73677.tmp
08-31 10:18:23.099 I/PackageParser( 93): uk.co.oketchup.blanketsquare: compat added android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE
08-31 10:18:23.129 I/ActivityManager( 93): Displayed activity com.android.packageinstaller/.InstallAppProgress: 320 ms (total 320 ms)
08-31 10:18:23.139 W/PackageParser( 93): Exception reading res/layout/main.xml in /data/app/vmdl73677.tmp
08-31 10:18:23.139 W/PackageParser( 93): java.io.IOException
08-31 10:18:23.139 W/PackageParser( 93): at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:207)
08-31 10:18:23.139 W/PackageParser( 93): at java.util.zip.ZipFile$ZipInflaterInputStream.read(ZipFile.java:432)
08-31 10:18:23.139 W/PackageParser( 93): at java.io.FilterInputStream.read(FilterInputStream.java:130)
08-31 10:18:23.139 W/PackageParser( 93): at org.apache.harmony.luni.util.InputStreamHelper.readFullyAndClose(InputStreamHelper.java:174)
08-31 10:18:23.139 W/PackageParser( 93): at java.util.jar.JarFile.getManifest(JarFile.java:307)
08-31 10:18:23.139 W/PackageParser( 93): at java.util.jar.JarFile.getInputStream(JarFile.java:385)
08-31 10:18:23.139 W/PackageParser( 93): at android.content.pm.PackageParser.loadCertificates(PackageParser.java:338)
08-31 10:18:23.139 W/PackageParser( 93): at android.content.pm.PackageParser.collectCertificates(PackageParser.java:509)
08-31 10:18:23.139 W/PackageParser( 93): at com.android.server.PackageManagerService.installPackageLI(PackageManagerService.java:5961)
08-31 10:18:23.139 W/PackageParser( 93): at com.android.server.PackageManagerService.access$2100(PackageManagerService.java:138)
08-31 10:18:23.139 W/PackageParser( 93): at com.android.server.PackageManagerService$5.run(PackageManagerService.java:4819)
08-31 10:18:23.139 W/PackageParser( 93): at android.os.Handler.handleCallback(Handler.java:587)
08-31 10:18:23.139 W/PackageParser( 93): at android.os.Handler.dispatchMessage(Handler.java:92)
08-31 10:18:23.139 W/PackageParser( 93): at android.os.Looper.loop(Looper.java:144)
08-31 10:18:23.139 W/PackageParser( 93): at android.os.HandlerThread.run(HandlerThread.java:60)
08-31 10:18:23.139 W/PackageParser( 93): Caused by: java.util.zip.DataFormatException: data error
08-31 10:18:23.139 W/PackageParser( 93): at java.util.zip.Inflater.inflateImpl(Native Method)
08-31 10:18:23.139 W/PackageParser( 93): at java.util.zip.Inflater.inflate(Inflater.java:255)
08-31 10:18:23.139 W/PackageParser( 93): at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:188)
08-31 10:18:23.139 W/PackageParser( 93): ... 14 more
08-31 10:18:23.149 E/PackageParser( 93): Package uk.co.oketchup.blanketsquare has no certificates at entry res/layout/main.xml; ignoring!
08-31 10:18:23.269 D/dalvikvm( 93): GC_EXPLICIT freed 5970 objects / 337960 bytes in 107ms
08-31 10:18:24.729 I/InstallAppProgress(20453): Finished installing uk.co.oketchup.blanketsquare
非常感谢你的帮助。
编辑02/09/2010 我通过删除几乎所有的空格再次修改了main.xml文件。它仍然没有安装,但不是完全相同的错误:它声称有一个zip文件错误,虽然我注意到证书确实出现在列表的下方。如果这不是我明显做错的事情,那么如果我在Android开发者邮件列表上提出它会更好吗?
09-02 17:33:32.819 W/PackageParser( 93): Exception reading /data/app/vmdl73692.tmp
09-02 17:33:32.819 W/PackageParser( 93): java.io.IOException
09-02 17:33:32.819 W/PackageParser( 93): at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:207)
09-02 17:33:32.819 W/PackageParser( 93): at java.util.zip.ZipFile$ZipInflaterInputStream.read(ZipFile.java:432)
09-02 17:33:32.819 W/PackageParser( 93): at java.io.FilterInputStream.read(FilterInputStream.java:130)
09-02 17:33:32.819 W/PackageParser( 93): at org.apache.harmony.luni.util.InputStreamHelper.readFullyAndClose(InputStreamHelper.java:174)
09-02 17:33:32.819 W/PackageParser( 93): at java.util.jar.JarFile.readMetaEntries(JarFile.java:360)
09-02 17:33:32.819 W/PackageParser( 93): at java.util.jar.JarFile.<init>(JarFile.java:237)
09-02 17:33:32.819 W/PackageParser( 93): at java.util.jar.JarFile.<init>(JarFile.java:218)
09-02 17:33:32.819 W/PackageParser( 93): at android.content.pm.PackageParser.collectCertificates(PackageParser.java:471)
09-02 17:33:32.819 W/PackageParser( 93): at com.android.server.PackageManagerService.installPackageLI(PackageManagerService.java:5961)
09-02 17:33:32.819 W/PackageParser( 93): at com.android.server.PackageManagerService.access$2100(PackageManagerService.java:138)
09-02 17:33:32.819 W/PackageParser( 93): at com.android.server.PackageManagerService$5.run(PackageManagerService.java:4819)
09-02 17:33:32.819 W/PackageParser( 93): at android.os.Handler.handleCallback(Handler.java:587)
09-02 17:33:32.819 W/PackageParser( 93): at android.os.Handler.dispatchMessage(Handler.java:92)
09-02 17:33:32.819 W/PackageParser( 93): at android.os.Looper.loop(Looper.java:144)
09-02 17:33:32.819 W/PackageParser( 93): at android.os.HandlerThread.run(HandlerThread.java:60)
09-02 17:33:32.819 W/PackageParser( 93): Caused by: java.util.zip.DataFormatException: data error
09-02 17:33:32.819 W/PackageParser( 93): at java.util.zip.Inflater.inflateImpl(Native Method)
09-02 17:33:32.819 W/PackageParser( 93): at java.util.zip.Inflater.inflate(Inflater.java:255)
09-02 17:33:32.819 W/PackageParser( 93): at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:188)
09-02 17:33:32.819 W/PackageParser( 93): ... 14 more
答案 0 :(得分:2)
我已经看到了损坏的.apks,它们无法加载到设备上,并带有奇怪的IOExceptions。在Eclipse中执行这些步骤似乎可以防止我看到的问题:
答案 1 :(得分:1)
原因是你的apk没有签名。
如果您正在使用eclipse,则需要在构建时对应用程序进行签名。您可以使用您的密钥对应用程序进行签名(如果有),或者您可以使用eclipse提供的调试密钥创建apk。
步骤:
点击项目&gt; Android工具&gt;导出已签名的应用程序包&#34; &GT;指定密钥库位置(对于调试密钥库,请查看计算机的主目录,调试密钥的密码是android)。
答案 2 :(得分:0)
尝试签署名为main.xml的文件时会引发一些异常
异常阅读/data/app/vmdl73677.tmp中的res / layout / main.xml
尝试删除或重新创建该文件,然后编译/签名并运行该应用程序
http://www.google.com/support/forum/p/Android%20Market/thread?tid=11b65a3c2807848a&hl=en