Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't recompile working APK with APKtool

Tags:

android

I decompiled an APK using APKTool 2.0 Beta 9 and then rebuilt all without doing changes to the sources. Then I rebuilt the APK using this command:

java -jar apktool.jar build myfolder myapk.apk

But I cannot install the generated APK file on my phone. It tells me:

Application not installed.

Am I missing something ? I even didn't change the code.

like image 467
Claudio Ferraro Avatar asked Mar 20 '23 11:03

Claudio Ferraro


1 Answers

Your new recompiled apk is not signed and according to the rules, you cannot install unsigned apk.

One good thing which I like is that you can self sign the apk file.

You will have to use "Keytool" for generating your own certificate.

Here is the command :

keytool –genkey –v -keystore [nameofkeystore] –alias [your_keyalias] –keyalg RSA –keysize 2048 –validity [numberofdays]

This will ask you few things, just fill it appropriately.

Once the certificate is generated, use "jarsigner" for signing your apk.

jarsigner –verbose –sigalg MD5withRSA –digestalg SHA1 –keystore [name of your keystore] [your .apk file] [your keyalias]

Now try installing your new apk file and everything should work fine.

EDIT - I am using keytool and jarsigner commands directly as I have set their paths in PATH variable. In your case, you will have to traverse to "bin" folder of the jdk directory. /bin/

like image 163
v1h5 Avatar answered Apr 01 '23 16:04

v1h5