tags:

views:

823

answers:

3

I have made a signed apk of an android project. Whenever my client try to run it on the emulator, he faces the following error message:

D:\Android\android-sdk-
windows\tools>adb install -r abc.apk
500 KB/s (6940708 bytes in 13.534s)
        pkg: /data/local/tmp/abc.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]

What is the resolution?

A: 

The good thing about building manually your apk is that you don’t have to name your resources directory to res, you can name it anything you want.

You can find ant scripts in: \platforms\android-1.5\templates\android-rules.xml

Step 1: Generate Resource java code and packaged Resources aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library} -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]

Step 2: Compile java source codes + R.java use javac

Step 3: Convert classes to Dalvik bytecodes use dx.bat dx.bat –dex –output=${output.dex.file} ${compiled.classes.directory} ${jar files..}

Step 4: Create unsigned APK use apkbuilder

apkbuilder ${output.apk.file} -u -z ${packagedresource.file} -f ${dex.file}

or

apkbuilder ${output.apk.file} -u -z ${packagedresource.file} -f ${dex.file} -rf ${source.dir} -rj ${libraries.dir}

-rf = resources required for compiled source files? -rj = resources required for jar files

Step 6: Generate a key use keytool

Step 7: Sign APK use jarsigner

jarsigner -keystore ${keystore} -storepass ${keystore.password} -keypass ${keypass} -signedjar ${signed.apkfile} ${unsigned.apkfile} ${keyalias}

Step 8: Publish use adb adb -d install -r ${signed.apk}

Inspecting your APK file:

aapt list -v latest.apk

Vishal
This answer appears to have no connection to the question..?
Christopher
+1  A: 

You could check if the client has not disabled installation of unsigned apps in the emulator.

the100rabh
All apps must be signed; an Android device (or emulator) will not accept an unsigned APK for installation.
Christopher
If you're referring to allowing non-Market apps, this setting doesn't apply when "sideloading" via `adb`.
Christopher
No I am specifically referring to allowing unsigned application to be allowed to be installed.
the100rabh
Ok, I haven't seen this setting before. I tried uploading an unsigned APK to a device and to an emultor and both refused it with `INSTALL_PARSE_FAILED_NO_CERTIFICATES`. Where would this be configured?
Christopher
The setting I am talking of is at Settings->Applications->Unknown Sources
the100rabh
That's the setting I referred to in my second comment (it allows non-Market apps, not unsigned apps). Try it for yourself; loading an unsigned APK onto either a device or emulator with "Unknown Sources" enabled *still* results in the device rejecting the APK. The PackageParser will say "Package com.example has no certificates at entry AndroidManifest.xml; ignoring!".
Christopher
+1  A: 

As mentioned by steelbytes, the error INSTALL_PARSE_FAILED_NO_CERTIFICATES suggests that the APK isn't signed like you think it is.

Run this command to verify which certificate was used to sign the APK:
jarsigner -verify -verbose -certs abc.apk

For each entry in the APK, you should see something like this:

sm    152412 Wed Oct 14 14:16:52 CEST 2009 classes.dex

      X.509, CN=Meebo, OU=Meebo, O=Meebo, L=Mountain View, ST=California, C=US
      [certificate is valid from 28/10/08 06:49 to 13/08/82 07:49]

Otherwise, if the APK isn't signed, you'll get the message jar is unsigned.

Christopher