2

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)

Failure [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="http://schemas.android.com/apk/res/android"
        android:sharedUserId="android.uid.phone"
            package="com.htc.fieldtest"
            android:versionCode="1"
            android:versionName="1.0" >

<application android:label="Field Test">
    <activity android:label="@string/app_name" 
              android:name="FieldTestActivity" 
              android:process="com.android.phone" 
              android:launchMode="singleInstance">

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

FelixA
  • 127
  • 5
  • 14

1 Answers1

3

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 not 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.

JesusFreke
  • 19,784
  • 5
  • 65
  • 68
  • 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? – FelixA Mar 12 '12 at 18:35
  • 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? " – FelixA Mar 12 '12 at 19:14