x


APK Signed for Android, but refuses to install

After building a game and testing it in debug mode, I've tried building the game and signing it for use on the market. The game seems to be signed without issue, and the market even lets me upload and publish it.

However, Android devices refuse to install it. I've tested using several devices, and this has me very puzzled. Especially considering the Android Market sees the APK as being signed and allows it be uploaded and even published/purchased. (Had a friend confirm this on his account).

I've tried all of the following :

generating the key from within Unity, using the standard interface.
generating the key using keytool and jarsigner.
generating the key both ways and then running zipalign(just in case).

Using the following tools:

64bit Win7, Unity 3.4.1 Android (I don't own pro yet), Java JDK 1.7.0, Android SDK r13

Any ideas or suggestions would be very appreciated.

Below is the result of running jarsigner -verify -verbose on the APK:

s 2719 Sun Oct 09 22:49:14 CDT 2011 META-INF/MANIFEST.MF

    2881 Sun Oct 09 22:49:14 CDT 2011 META-INF/AX1311.SF

    1178 Sun Oct 09 22:49:14 CDT 2011 META-INF/AX1311.DSA

sm 14336 Sun Oct 09 22:49:08 CDT 2011 assets/bin/Data/Managed/Assembly-UnityScript.dll

sm 125440 Sun Oct 09 22:49:08 CDT 2011 assets/bin/Data/Managed/Boo.Lang.dll

sm 292864 Sun Oct 09 22:49:08 CDT 2011 assets/bin/Data/Managed/Mono.Security.dll

sm 1068544 Sun Oct 09 22:49:10 CDT 2011 assets/bin/Data/Managed/System.dll

sm 444416 Sun Oct 09 22:49:10 CDT 2011 assets/bin/Data/Managed/UnityEngine.dll

sm 2495488 Sun Oct 09 22:49:10 CDT 2011 assets/bin/Data/Managed/mscorlib.dll

sm 3023 Sun Oct 09 22:49:10 CDT 2011 assets/bin/Data/level0

sm 1231 Sun Oct 09 22:49:10 CDT 2011 assets/bin/Data/level1

sm 1191 Sun Oct 09 22:49:10 CDT 2011 assets/bin/Data/level2

sm 10865 Sun Oct 09 22:49:10 CDT 2011 assets/bin/Data/mainData

sm 150 Sun Oct 09 22:49:10 CDT 2011 assets/bin/Data/settings.xml

sm 3126951 Sun Oct 09 22:49:10 CDT 2011 assets/bin/Data/sharedassets0.assets

sm 350261 Sun Oct 09 22:49:12 CDT 2011 assets/bin/Data/sharedassets1.assets

sm 515 Sun Oct 09 22:49:12 CDT 2011 assets/bin/Data/sharedassets2.assets

sm 515 Sun Oct 09 22:49:12 CDT 2011 assets/bin/Data/sharedassets3.assets

sm 20863 Tue Sep 13 13:53:10 CDT 2011 assets/bin/Data/splash.png

sm 2246019 Sun Oct 09 22:49:12 CDT 2011 assets/bin/Data/unity default resources

sm 3743444 Sun Oct 09 22:49:12 CDT 2011 assets/libs/armeabi-v7a/libmono.so

sm 6286608 Sun Oct 09 22:49:12 CDT 2011 assets/libs/armeabi-v7a/libunity.so

sm 89832 Tue Sep 13 14:01:20 CDT 2011 classes.dex

sm 3483 Sun Oct 09 22:49:04 CDT 2011 res/drawable/app_icon.png

sm 3440 Sun Oct 09 22:49:14 CDT 2011 AndroidManifest.xml

sm 920 Sun Oct 09 22:49:04 CDT 2011 resources.arsc

sm 6563 Sun Oct 09 22:49:04 CDT 2011 res/drawable-hdpi/app_icon.png

sm 98120 Tue Sep 13 14:01:22 CDT 2011 lib/armeabi-v7a/libmono.so

sm 56240 Tue Sep 13 14:01:22 CDT 2011 lib/armeabi-v7a/libunity.so

s = signature was verified

m = entry is listed in manifest

k = at least one certificate was found in keystore

i = at least one certificate was found in identity scope

jar verified.

Warning: This jar contains entries whose certificate chain is not validated.

more ▼

asked Oct 10 '11 at 05:19 AM

cmccown gravatar image

cmccown
31 1 1 2

(comments are locked)
10|3000 characters needed characters left

4 answers: sort voted first

You should run logcat (android sdk folder, plattform tools typically, there is an adb.exe. Then do Start > Run > cmd.exe > switch to that folder and type "adb.exe logcat"). Of course you have to enable "USB Debugging" too in your Android phone.

Once logcat is started, open Market and download your game and pause logcat after the download fails and look there.

It's probably not a problem with signing but one that your game is to big for your phones cache (i.e. HTC Desire only has 40 MB where some big chunk is already used by the OS and you typically get ~25 MB). Since HTC Desire uses the /cache partition for downloads (market downloads too), it can't download (and install) games which are bigger than the free space there.

If that's the issue, you should be able to identify it via logcat, as Market (Vending) will display such errors in logcat

edit: There is also another thing which could cause problems on developer devices: When you push the game with Unity3d on the phone you, most developers push the version which is signed with the android debug key. This works for development. But once the game is released, it's signed with the retail key.

The problem is: You can only install or "upgrade" versions which have identical signatures. So if your developer version is still installed on your phone, you must uninstall it first, before you're able to install it from the market.

Go to Settings > Applications > Manage Applications and select your game and hit uninstall. This will remove the game completely from your device (also any saved data) and delete all the private folders in the internal memory. Now you should be able to install it from the market.

The reason for this is: Android uses the signatures to make sure that the game or it's update is coming from the developer who initially published it. So if the signature is changed (i.e. signed by a different key), Android will refuse to update it.

That being said, you should backup your signature key very carefully, because if you lose it once, you will never be able to release any updates to your existing game (you would have to change it's package name and add it as a new entry. All existing users won't get notified about updates until they download the new version... of course they lose all progress)

edit2: With the error message from your latest comments, I found this one

http://forum.unity3d.com/threads/100334-Install_parse_failed_no_certificates

Seem as you have to uninstall JDK 1.7 and use 1.6 instead.

more ▼

answered Oct 11 '11 at 02:36 AM

Tseng gravatar image

Tseng
1.6k 7 9 24

Oops sorry misread that :p

Oct 11 '11 at 05:36 AM Meltdown

Awesome, thanks guys. I'll give this a shot this evening and let you guys know what I discover.

Will logcat work when I attempt to install the device locally?

I would prefer not to republish the work until I confirm it is working on the market, and I can't seem to find it on the market unless I publish to the world.

Oct 11 '11 at 01:07 PM cmccown

I don't think so, since at least for me, the files are pushed to /data

adb install ThePirateGame-snapdragon.apk * daemon started successfully * 1386 KB/s (16071915 bytes in 11.317s) pkg: /data/local/tmp/ThePirateGame-snapdragon.apk

But you should look at the logcat first what the market reports while you attempt to download/install it and edit your question with the result. Maybe it will also display another error.

Just on the side note: How big is your APK file (in MB)?

Oct 11 '11 at 01:29 PM Tseng

7.7MB

I don't think the file size is causing the problem, but I'm willing to try anything. I'm using mostly png and tga files for my images and I'm using the built in primitives wherever I can to conserve space.

I did use raw wav files for audio, but zipalign should compress those down to a reasonable size, right?

Thanks again.

Oct 11 '11 at 01:39 PM cmccown

7.7 MB is quite small, so yea... shouldn't be a problem. They usually start with >=25 MB on some devices (especially the older ones with custom UI like HTC Sense where the /data partition size got reduced in favor of a bigger /system or /data partition, because custom UIs like HTC Sense require more internal space).

What does Logcat says during installation?

I've updated my answer from above with another common source of errors

Oct 11 '11 at 01:59 PM Tseng
(comments are locked)
10|3000 characters needed characters left

Try this...

1.) Make sure the jdkbin path is in the Windows Environment Variable PATH. (Both 32 & 64 bit paths for good measure)

2.) Close and reopen Unity

3.) Create a brand new keystore file from scratch. Make sure your password is 100% correct

I had the same problem and that worked for me. I would also zipalign your .apk once its been built and signed. Let me know if you need help with that.

more ▼

answered Oct 10 '11 at 06:08 AM

Meltdown gravatar image

Meltdown
6.3k 21 31 53

Thanks Meltdown, good idea.

I've only used the 64 bit JDK to sign the APK this far.

I'll try the 32 bit and 64 bit versions separately tonight when I get home and then if neither works individually I'll test with both JDK versions and see if that works.

A 64 bit vs. 32 bit compatibility issue might explain why Windows and Android Market's servers see the file as being signed but the devices do not.

Crossing my fingers, I'll let you know how it goes.

Oct 10 '11 at 03:16 PM cmccown

I installed both versions of the JDK. I run Win 7 64-bit. Set the PATH for both. Good luck :p

Oct 10 '11 at 04:14 PM Meltdown

Ugh, still no luck. Thanks anyway. Submitting a ticket to Google Developer Help. We'll see what they say.

Oct 11 '11 at 01:56 AM cmccown
(comments are locked)
10|3000 characters needed characters left

Argh, OK. Closer, but still not there.
I'm not even getting a warning message now, but I still can't install the app to a device. This test was done with the i586 install of JDK listed first and the x68 install second in the PATH variable.

If I get different results with the paths reversed I'll update, but if you have any other ideas to try please let me know.

Thanks!

s k 2719 Mon Oct 10 17:13:08 CDT 2011 META-INF/MANIFEST.MF

    2881 Mon Oct 10 17:13:08 CDT 2011 META-INF/IRGAMES.SF

    1164 Mon Oct 10 17:13:08 CDT 2011 META-INF/IRGAMES.DSA

smk 14336 Mon Oct 10 17:13:02 CDT 2011 assets/bin/Data/Managed/Assembly-UnityScript.dll

smk 125440 Mon Oct 10 17:13:02 CDT 2011 assets/bin/Data/Managed/Boo.Lang.dll

smk 292864 Mon Oct 10 17:13:02 CDT 2011 assets/bin/Data/Managed/Mono.Security.dll

smk 1068544 Mon Oct 10 17:13:02 CDT 2011 assets/bin/Data/Managed/System.dll

smk 444416 Mon Oct 10 17:13:02 CDT 2011 assets/bin/Data/Managed/UnityEngine.dll

smk 2495488 Mon Oct 10 17:13:02 CDT 2011 assets/bin/Data/Managed/mscorlib.dll

smk 4719 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/level0

smk 3065 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/level1

smk 1189 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/level2

smk 7387 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/mainData

smk 150 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/settings.xml

smk 396143 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/sharedassets0.assets

smk 3081057 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/sharedassets1.assets

smk 350295 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/sharedassets2.assets

smk 473 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/sharedassets3.assets

smk 20863 Tue Sep 13 13:53:10 CDT 2011 assets/bin/Data/splash.png

smk 2246019 Mon Oct 10 17:13:04 CDT 2011 assets/bin/Data/unity default resources

smk 3743444 Mon Oct 10 17:13:04 CDT 2011 assets/libs/armeabi-v7a/libmono.so

smk 6286608 Mon Oct 10 17:13:06 CDT 2011 assets/libs/armeabi-v7a/libunity.so

smk 89832 Tue Sep 13 14:01:20 CDT 2011 classes.dex

smk 3483 Mon Oct 10 17:12:58 CDT 2011 res/drawable/app_icon.png

smk 3440 Mon Oct 10 17:13:06 CDT 2011 AndroidManifest.xml

smk 920 Mon Oct 10 17:12:58 CDT 2011 resources.arsc

smk 6563 Mon Oct 10 17:12:58 CDT 2011 res/drawable-hdpi/app_icon.png

smk 98120 Tue Sep 13 14:01:22 CDT 2011 lib/armeabi-v7a/libmono.so smk 56240 Tue Sep 13 14:01:22 CDT 2011 lib/armeabi-v7a/libunity.so

s = signature was verified m = entry is listed in manifest k = at least one certificate was found in keystore i = at least one certificate was found in identity scope

jar verified.

more ▼

answered Oct 10 '11 at 10:23 PM

cmccown gravatar image

cmccown
31 1 1 2

(comments are locked)
10|3000 characters needed characters left

Final answer...

DO NOT USE JDK 1.7.0 EVER.

Seems that was the problem, when I changed to JDK 1.6 the universe stabilized and sanity returned. Thanks everyone. I really hope this helps someone else out there.

more ▼

answered Oct 11 '11 at 06:41 PM

cmccown gravatar image

cmccown
31 1 1 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x121
x118
x16

asked: Oct 10 '11 at 05:19 AM

Seen: 7603 times

Last Updated: Oct 11 '11 at 06:47 PM