Android Tutorial Producing unsigned apk and sign it with eclipse/adt keystore

Ok, this is my first tutorial so please be kind about my errors :D


Here is problem : You have an app made without B4A. You wantto remake it but you need to sign it with your old (eclipse/adt/etc.) keystore.

Solution in steps

1. You need unsigned apk. Luckly B4A genarates an unsigned apk version for us but you need to copy that file while building progress.

In your main activity, add following line to #Region Module Attributes

B4X:
#CustomBuildAction: 3, c:\windows\system32\cmd.exe, /c copy bin\temp.ap_ unsigned.apk

this will copy the unsigned apk from bin directory to objects directory with name : unsigned.apk

2. you need your old keystore file and its username and password.

3. for make life easier, make a temp folder and copy following files into that folder.
B4X:
eclipseKeystoreFile.keystore
unsigned.apk
zipalign.exe

you can find the zipalign.exe from your SDK FOLDER / build-tools / VERSION NUMBER / zipalign.exe

okey, others are easier.

3. Start cmd console (Start/Run/Cmd)

4. Navigate your temp folder (cd d:\tempfolder)

5. Sign apk with jarsigner. Please follow parameters carefuly.
B4X:
jarsigner -verbose -keystore eclipseKeystoreFile.keystore unsigned.apk yourusername

enter your keystore password (it will not shown but enter, so be sure write it correctly)

you sould see at least
jar signed

Warning:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

never mind warning. its signed now.

6. Now you need to align apk. Here is tricky part.
IF YOU USE THREAD IN YOUR APPLICATION YOU NEED TO ENTER PARAMETERS CORRECTLY AS FOLLOWING !!!!!
B4X:
zipalign -v -p 4 unsigned.apk yourapkname.apk

you need to see at least : Verification successful.

Congratulations, you have successfuly sign your apk with external keystore.
Now you can upload it to PlayStore.

Thank you.
 

mesutaslan

Member
Licensed User
Longtime User
Okey there are a few changes on 2017.

Now please follow fallowing commands:

B4X:
zipalign -v -p 4 YOUR-PATH\unsigned.apk YOUR-PATH\signed.apk

apksigner sign --ks YOUR-PATH\Keystore.keystore YOUR-PATH\signed.apk

apksigner verify --verbose YOUR-PATH\signed.apk

the apksigner in your sdk\build-tools
 
Top