开发者

Cannot install .apk on phone

I've just knocked together my first app, have released and signed it and transferred to my phone, but cannot get it to install on my phone - after going through the screen saying 'Do you want to install this application' and clicking install, I just get a message saying 'Application not installed' with no further explanation. I had checked the signing using jarsigner -verify.

I have uploaded the .apk to http://ubuntuone.com/p/ESB/ and obtained the log using the LogCollector app on my phone. The relevant extract is reproduced below.

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

Many thanks for your help.


Edit 02/09/2010 I have modified the main.xml file again by removing pretty much all the whitespace. It still does not install but is not quite the same error: it's claiming there is a zip file error although I notice that certificates do appear further down the list. If this is not something I'm obviously doing wrong, would it be better if I raised on android developers mailing list?

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


I've seen corrupted .apks that won't load on a device, with weird IOExceptions. Following these steps in Eclipse seems to prevent the problems I've seen:

  1. Make sure that Project -> Build Automatically is turned off (that is, unchecked)
  2. Project -> Clean..., select "Clean All Projects", make sure the "Start a Build Automatically" checkbox is unchecked, and click OK.
  3. Use File -> Export -> Android -> Export Android Application to create the APK


The reason for this is that your apk is not signed.

If you are using eclipse you would need to sign the application while building. You can sign the application using the your keys , if you have, or you can create an apk with debug keys provided with eclipse.

Procedure:

Rtclick on project> Android tools> Export Signed application package" > specify the keystore location (for debug keystore look at the home directory of your computer, the password for debug key is android).


There is some exception being raised while trying to sign the file named main.xml

Exception reading res/layout/main.xml in /data/app/vmdl73677.tmp

Try to delete or recreate that file and then compile/sign and run the application

http://www.google.com/support/forum/p/Android%20Market/thread?tid=11b65a3c2807848a&hl=en

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜