Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-sign an Android Apk

How can I Re-sign an android apk. I referred to this answer Can I re-sign an .apk with a different certificate than what it came with?

but got stuck with Android Manifest.xml missing error.

like image 529
neeraj Avatar asked Aug 19 '11 09:08

neeraj


People also ask

How do I re sign an APK?

Unpack/ Unzip the zip file. Delete the META-INF folder. Repack/ Rezip the folder again to a zip file. Rename the zip file again to an apk file.

How do I sign an unsigned APK?

Sign an APK You can include this information in two different ways: Specify a KeyStore file using the --ks option. Specify the private key file and certificate file separately using the --key and --cert options, respectively. The private key file must use the PKCS #8 format, and the certificate file must use the X.

How do I sign an APK file on my Android?

In the menu bar, click Build > Generate Signed Bundle/APK. In the Generate Signed Bundle or APK dialog, select Android App Bundle or APK and click Next. Below the field for Key store path, click Create new. On the New Key Store window, provide the following information for your keystore and key, as shown in figure 2.

Can we manually sign a APK?

Sign the APK with jarsigner This technique involves signing the APK file using the jarsigner command from the Java SDK. The jarsigner tool is provided by the Java SDK. When using jarsigner, it is important to sign the APK first, and then to use zipalign.


2 Answers

Friends I found a work around to this . Resign Android Apk using android default debug.keystore.

  1. **Open the apk in the winzip browser and not by unzipping to a folder.

  2. Delete META-INF folder .zipping again is not required.**

  3. Jarsigner -verbose -keystore debug.keystore yourapk.apk aliasname

    **Example** `-Jarsigner –verbose –keystore debug.keystore androiddebugkey.`
    
  4. jarsigner -verify yourapk.apk

  5. zipalign -v 4 yourapk.apk signedapk.apk

Step 1 and 2 was where I was doing wrong which gave me androidmanifest xml missing error.

like image 141
neeaj Avatar answered Oct 04 '22 01:10

neeaj


Downgrading to JDK 1.6.0_43 solved the problem.

To sign apks using JDK 1.7 one has to use these keywords "-sigalg MD5withRSA -digestalg SHA1"

Reason: As of JDK 7, the default signing algorithim has changed, requiring you to specify the signature and digest algorithims (-sigalg and -digestalg) when you sign an APK.

Command: jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore [keystorefile] [originalapk] alias_name

like image 20
Vihana Kewalramani Avatar answered Oct 04 '22 01:10

Vihana Kewalramani