Android Tutorial Tutorial - How to sign apk with non-B4A keystore

Here is my first tutorial for the community!

This tutorial will show you how to sign a B4A generated apk with a non-B4A keystore. I needed a way to do this for myself since I had some apps out created using AppInventor that I remade using B4A. On to the tut:

1. When you are ready to publish, You need to use B4ABuilder to compile an unsigned apk.
"C:\Program Files (x86)\Anywhere Software\Basic4Android\B4ABuilder.exe" -Task=Build -NoSign=True -Obfuscate=true
2. Go to \Main\Objects\bin and find the file called "temp.ap_". This is your app. Rename this file accordingly (i.e. "myapp.apk").
3. Copy your keystore file to the same directory as myapp.apk.
4. To make life easier, navigate to your android sdk folder and copy this file: \android-sdk\tools\zipalign.exe to the same folder as your apk and keystore.
5. Open Windows Command Prompt. Navigate to the folder where myapp.apk, keystore, and zipalign are
6. In Command Prompt type: jarsigner -verbose -keystore mykeystore.ks myapp.apk username
Change "mykeystore.ks" to your keystore's file name. Change "myapp.apk" to your app's file name. Change "username" to the username used in your keystore.
7. Enter your password when asked.
8. When it's finished, type this: zipalign -v 4 myapp.apk myapp_aligned.apk
9. You're done! myapp_aligned.apk is the file you'll need to upload to the market
 
Last edited:

JonPM

Well-Known Member
Licensed User
Longtime User
You need to use B4ABuilder to compile an unsigned apk.

"C:\Program Files (x86)\Anywhere Software\Basic4Android\B4ABuilder.exe" -Task=Build -NoSign=True -Obfuscate=true

Then you use jarsigner and zipalign.
 

Baris Karadeniz

Active Member
Licensed User
Follow these steps:
- Close the IDE
- Go to: C:\Users\<user name>\AppData\Roaming\Anywhere Software\Basic4android
- Open the INI file
- Change the keystore alias (SignKeyAlias property)

There is no such a folder in my computer. My user name contains characters like ş and ı. This can be the reason? And where can I see this folder?
 

Baris Karadeniz

Active Member
Licensed User
Here is my first tutorial for the community!

This tutorial will show you how to sign a B4A generated apk with a non-B4A keystore. I needed a way to do this for myself since I had some apps out created using AppInventor that I remade using B4A. On to the tut:

1. When you are ready to publish, You need to use B4ABuilder to compile an unsigned apk.
"C:\Program Files (x86)\Anywhere Software\Basic4Android\B4ABuilder.exe" -Task=Build -NoSign=True -Obfuscate=true
2. Go to \Main\Objects\bin and find the file called "temp.ap_". This is your app. Rename this file accordingly (i.e. "myapp.apk").
3. Copy your keystore file to the same directory as myapp.apk.
4. To make life easier, navigate to your android sdk folder and copy this file: \android-sdk\tools\zipalign.exe to the same folder as your apk and keystore.
5. Open Windows Command Prompt. Navigate to the folder where myapp.apk, keystore, and zipalign are
6. In Command Prompt type: jarsigner -verbose -keystore mykeystore.ks myapp.apk username
Change "mykeystore.ks" to your keystore's file name. Change "myapp.apk" to your app's file name. Change "username" to the username used in your keystore.
7. Enter your password when asked.
8. When it's finished, type this: zipalign -v 4 myapp.apk myapp_aligned.apk
9. You're done! myapp_aligned.apk is the file you'll need to upload to the market

When I try to do item 6, I receive an error below. Can iı be because of wrong username? Or the problem is different? What should I do?

'jarsigner" is not recognized as an internal or external command
 

An Schi

Well-Known Member
Licensed User
Followed the instructions in post 1 for my appinventor app. Worked as described.
Thanks for the tutorial! :)
 

Tech4

Member
Licensed User
I want to update apk at google play store from app inventor to b4a.
and I follow this threads but I got this error...

jarsigner: Certificate chain not found for: Test1. Test1 must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

What is the possibility of My mistake?
 

Almora

Well-Known Member
Licensed User
Longtime User
hi..

the error signature I'm getting my old apps.
I'm using b4a v6.0
my password is right.
 

Attachments

  • 2016-10-25 06-03-04-232.jpg
    2016-10-25 06-03-04-232.jpg
    214 KB · Views: 424
Top