classes.dex generado por smali no funciona en .apk

I tried to generate a .apk from a classes.dex generated by samli. But I get these erros:

Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE] (when I try to install the .apk on the emulator)

Error [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES] (when I try to install the .apk on my phone).

Here are the steps what I have done:

  1. Extraced classes.dex from an existing .apk
  2. ./baksmali classes.dex
  3. ./smali out
  4. mv out.dex classes.dex
  5. Extracted the whole .apk content in a folder and replaced classes.dex which the new one
  6. Generated a .zip-file and renamed it to *.apk
  7. signed the app: jarsigner -verbose -keystore my-release-key.keystore MyFieldTest.apk mykey

Here is the beginning of the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
            android:versionName="1.0" >

<application android:label="Field Test">
    <activity android:label="@string/app_name" 

I know that the app was first signed by a HTC devloper and now by me. But is there as possibility to fix the problem?

Thanks! Felix

preguntado el 10 de marzo de 12 a las 13:03

1 Respuestas

It sounds like you might have multiple signatures in the new apk files. Try deleting the files in META-INF directory before creating the new zip.

Also, Your new apk probably has compressed resources now. I'm not sure how android will handle that. In the apk files that aapt generates, the resources (images, xml, etc.) are no compressed, so that they can be mapped into memory directly, without having to extract them.

If you aren't modifying the resources, your best bet is to replace the classes.dex file in the original apk file, rather than creating a new one. If you are trying to modify the resources as well, you should use apktool to extract/repack the apk instead.

respondido 11 mar '12, 03:03

Thank you! Now I replaced the classes.dex in the original apk. Now I got the following failure on my device and the emulator: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]. Second point I was wondering, that the classes.dex generated by samli is 91'048B long and the original is 91'060B long. Propably optimization. Or? - FélixA

I deleted all the files in die META-INF folder with "aapt r ...". Before signing I got the failure while installing the app: "Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]". Afters signing "Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE]". Any idea what to do? " - FélixA

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.