Android Tutorial Signing your application before uploading to Google Play

Status
Not open for further replies.
The result of compiling your application is an APK file. This is a package file that contains the compiled source code and the assets files.
The APK file must be signed before installation. Signing the file means that it is not possible to later modify it without the private key that was used to sign the file.
Android devices will not install an unsigned APK file.

Basic4android uses a default "debug key" to sign applications. This key is fine during debugging. However Android market doesn't accept APK files signed with this key.
You need to create your own private key.
Fortunately it is pretty simple to create such key.
Choose Tools - Private Sign Key

sign_1.png


This dialog allows you to create a new key, load an existing one or to use the debug key.
Keys are stored in a keystore file.
It is not possible to access such a file without its password.

Once you created a new keystore file, Basic4android will use this key for all your projects.
You should be very careful with this file. If this file gets lost you will not be able to update your applications in the market. You will need to publish updates as new applications.
It is impossible to recreate a lost keystore file.
Therefore it is recommended to backup this file.

In the IDE, when you reinstall an application and use a different key, you will see this message:
sign_2.png


Pressing yes will uninstall the previous application and install the new one.
 

chfajardo

Member
Licensed User
Longtime User
Still have problems to load a valid private sign key

Erel,

The steps i´m taking are simple:

1. If i create the private sign key right now and click ok, it works real fine.
2. If i try to load this same private sign key, i have the error message.
Note: I was able to sign my application using this batch file i wrote:

path = E:\Program Files\Java\jdk1.6.0_29\bin
jarsigner -verbose -keystore chave01.keystore -keypass xxxxxxxxxxx /bin/temp.ap_ b4a
path = E:\Program Files\Android\android-sdk\tools
zipalign -f -v 4 ./bin/temp.ap_ controlador_artnet_FULL_chfsoft.apk

So, it is clear that my private sign key is valid, and i even updated my android markey application.
Now the question is: Why i can not load my valid private sign key?
There are the steps i followed in the images attached.

-Image one: There is the screen when i click tools -> private sign key. If i click ok here, it works;

-Image two: Here, i have clicked the browse button and selected the same private sign key.

-Image three: Identical to image one, but in this one i have browsed and selected the private sign key. Now when i click the Ok button, i get this error.
 

chfajardo

Member
Licensed User
Longtime User
Problems loading private sign key

Erel,

I will do better.
I am generating a new key using Basic4Android and will send to your e-mail.
 

chfajardo

Member
Licensed User
Longtime User
problem loading keystore file

Erel,

As i told you, none of my keystore files generated in Basic4Android is being loaded with success. I tryed this one too, and i have the same error.
The Load option is not working for me, and i don't know why.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The file you sent me works fine here.

When a keystore file is loaded, the keytool.exe -list command is issued to check that the password is correct. I do not know why it fails on your computer.
You can try putting the keystore file in a path without spaces and any special characters, though I doubt that it will help.

You can however edit the INI file while Basic4android is closed and manually set the SignKeyFile and SignKeyPassword values. This should work.
The ini file is located here:
C:\Users\<user>\AppData\Roaming\Anywhere Software\Basic4android\b4aV0.1.ini
 

chfajardo

Member
Licensed User
Longtime User
Problems loading private sign key

Erel,

I will try this!
As soon i get it working i will tell you!

Best regards,

Carlos H. Fajardo.
 

chfajardo

Member
Licensed User
Longtime User
Problems loading private sign key

Erel,

It works now, but it would be nice if i haven't to change the ini file every time.
It still shows me the same error when i click Ok Button.
Anyway, now i can compile my application and update it again on Android Market.
If it helps you, i'm using Windows 7 Home Premium and the installation is on drive E:

Please let me know if you get some fix for this issue.

Thanks!

Carlos H. Fajardo.
 

cheese

Member
Licensed User
Longtime User
The key is saved in this file. You should choose the saving location.

"The key is saved in this file" << which file? The one I am supposed to choose? I don't know what file to choose. Can I choose any file?

"You should choose the saving location" << Oh, so I am not supposed to select a file - I am supposed to choose a directory? Which directory?
 

pilbazan

Member
Licensed User
Longtime User
Always the same keystore file?

Hi,

I have a doubt. It is possible to use always the same 'keystore file' for all my applications? Or is better generate a new 'keystore file' for each new application? (always thinking in upload the application to the Market).

Thanks a lot
 

NJDude

Expert
Licensed User
Longtime User
One Keystore file is enough, however you can create more but keeping track of which app has which keystore might turn ugly.
 

chfajardo

Member
Licensed User
Longtime User
keystore files

I strongly suggest you to use always the same keystore file, because even with Basioc4Android v.1.9 i still am not able to load keystore files. The only that works os the default one, if i do not try to load it.
 

moster67

Expert
Licensed User
Longtime User
It also depends on if you are only licensing the app or if you are also selling the sources.

For a hired app I did, they paid me for the license to use the app in their name and while in this case it could have been sufficient to use only my own developer-key (since I would continue maintaining/improving the app myself), I still decided to create a specific developer-key for that app (and that company).

Important thing: keep the developer-key(s) in a safe place :D
 

t0mt0m

Member
Licensed User
Longtime User
I put in my name, organization, country, and password, And when I hit ok i get this message saying Invalid file.

I am at registred User. Can you help me Please
 
Status
Not open for further replies.
Top