Android Release APK - debug name

Monkey Forums/Monkey Bug Reports/Android Release APK - debug name

therevills(Posted 2011) [#1]
When compiling for Android with the flag -config=release, it creates an APK with the name: MonkeyGame-debug.apk


Supertino(Posted 2011) [#2]
I noticed this to


marksibly(Posted 2011) [#3]
Hi,

I'll look into it, but from memory you can only run debug apps on devices without 'certification' and all that other fun crap,so I probably hardcoded it that way.


therevills(Posted 2011) [#4]
For a full release (ie to the public) it does need to be signed correctly. When Eclipse and Monkey sends it to the app it signs a debug certifcate so you can run it - but that shouldnt effect the name of the apk.


marksibly(Posted 2011) [#5]
Hi,

Hmmm...

http://developer.android.com/guide/developing/building/building-cmdline.html

In particular:


Before you start building your application in release mode, be aware that you must sign the resulting application package with your private key, and should then align it using the zipalign tool.



The docs strongly imply this applies to ALL apps - ie: ALL release mode apps need to be signed with a private key, whether they run on the simulator or hardware or whatever. I don't have a release mode key myself - any idea where I can get one?

But I don't think this'll make any difference to app performance - when you do a release build, all Monkey debugging stuff is disabled, and I think 'debug Java' will be the same as 'release Java' - ie: you can't disable null object and array index checks in Java anyway.


xlsior(Posted 2011) [#6]
From what I've heard, you can generate your own release key with one of the developer tools, no need to purchase anything. Keys have an expiration date, but the recommendation I read was to set it for 30 years, that should be enough for pretty much anything.

Supposedly the need for the kerys is that Android uses those to identify the app, so it recognizes the publisher and will permit an in-place update while retaining existing data files belonging to the game.

Without the proper key, a newer version would not have access to the old program's data.


therevills(Posted 2011) [#7]
When I was messing around with Libgdx, I looked up about signing apps:

Here is how to sign an Android App:

1. Create a folder called "keytools" and make a folder in that called "keys"
2. Using Eclipse, in Package Explorer window, right click on your project > Android Tools > Exports Unsigned Application Package and save in the keytools folder ("filename.apk")
3. Open command prompt (cmd.exe)
4. Navigate to your keytools folder
5. Type the following:
C:\"Program Files"\Java\jdk1.6.0_24\bin\keytool -genkey -alias myapp.keystore -keyalg RSA -validity 20000 -keystore keys/myapp.keystore

Then following the questions...

6. Type the following:
C:\"Program Files"\Java\jdk1.6.0_24\bin\jarsigner -verbose -keystore keys/myapp.keystore -signedjar filename-signed.apk filename.apk myapp.keystore

Done!


xlsior(Posted 2011) [#8]
And make sure to store your private key in a safe place if you intend to ever release an update to the app in the future. :-?
Without it, users will have to uninstall the old version and install the new one manually.


marksibly(Posted 2011) [#9]
Hi,

> Here is how to sign an Android App:

Any way to do it without Eclipse?

Be nice to build it into trans somehow.


therevills(Posted 2011) [#10]
I didnt know... Google did :P

Step 4: Create unsigned APK
use apkbuilder

apkbuilder  ${output.apk.file} -u -z  ${packagedresource.file} -f  ${dex.file}

or

apkbuilder  ${output.apk.file} -u -z  ${packagedresource.file} -f  ${dex.file}  -rf  ${source.dir}  -rj  ${libraries.dir}

-rf = resources required for compiled source files?
-rj = resources required for jar files


http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/

I havent tested this!!


Bremer(Posted 2011) [#11]
Hi Mark, could you please consider to take a look at getting it setup so that we can get our apps signed from within the monk ide or other so that we can get apps released onto the marketplace without having to setup our projects with the Eclipse work around?


Canardian(Posted 2011) [#12]
I created yesterday my own companyname.keystore file from the command line only using these instructions: http://developer.android.com/guide/publishing/app-signing.html, and then I was able to recompile a monkey app with "ant release build.xml" from the command line, which then created automatically the following files:
1) MonkeyGame-release.apk (which was signed and aligned)
2) MonkeyGame-unsigned.apk
3) MonkeyGame-unaligned.apk

Monkey should do this too, when the user has specified the location of his company.keystore file in some monkey config file.