Debug Build

Monkey Targets Forums/Android/Debug Build

Wagenheimer(Posted 2011) [#1]
How to create a Non Debug Build for an Android App?

I get this error when trying to publish an Android App.

Market does not accept apks signed with the debug certificate. Create a new certificate that is valid for at least 50 years.
Market requires that the certificate used to sign the apk be valid until at least October 22, 2033. Create a new certificate.
Market requires the minSdkVersion to be set to a positive 32-bit integer in AndroidManifest.xml.


Wagenheimer(Posted 2011) [#2]
Well... I have solved this!

Basicaly I have to load it on Eclipse and Right Click the Project and use Export - Android Application... There I can create a new certificate.


therevills(Posted 2011) [#3]
I found these instructions awhile ago:

http://www.talkandroid.com/android-forums/android-market-reviews/1317-tutorial-signing-your-apk-publishing.html

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!


Bremer(Posted 2011) [#4]
What if you are not using Eclipse, but using the default Monkey IDE, then what? The ability to sign the app correctly so that it could be published really should be part of the Monkey package.


FlameDuck(Posted 2011) [#5]
The .apk file is really just a jar, which is really just a zip file so...

1) Unsigning your apk: In the root directory of your apk is a folder named META-INF, which contains the files CERT.SF and CERT.RSA. Delete these. Your app is now unsigned. Using Eclipse is just overkill.
2) Run keytool/jarsigner as explained above. Note: You should only generate the key once.

I suppose if anyone was inclined to do so, you could even add it to the ant script (build.xml) that MonkeyIDE uses to build Android applications, so it's done for you automatically.


Virtech(Posted 2011) [#6]
I would love to see this functionality implemented in JungleIDE. Along with a configuration panel for setting icons/screenres/orientation etc.


FlameDuck(Posted 2011) [#7]
Along with a configuration panel for setting icons/screenres/orientation etc.
Any half-decent XML editor (and I'm pretty sure JungleIDE qualifies) will let you edit the "AndroidManifest.xml" which more or less is what you're asking for.

Be advised that if you restrict your game in any way, for instance to run in a specific resolution, it will not show up in the Android store for people who have phones that do not explicitly support that resolution, which might have a significant impact on sales.

Edit: Also remember that the AndroidManifest.xml is platform specific, so a graphical interface to change this, might not make sense on a multi-platform environment (Monk.exe or JungleIDE). However since Monk.exe (and I'm guessing JungleIDE too) use Ant for building, and Ant is a ridiculously powerful build tool, there is no reason why you couldn't change the Ant build script to do this, either automatically by contract (build.properties) or convention(always copy the games "res" folder on top of the BRL one, and merge the two AndroidManifest.xml files).


Virtech(Posted 2011) [#8]
I agree about the specific res. But instead of editing the manifest manually it would still be easier to choose between different "basic" screen behavior options in one config panel. Obviously this config window would have to be custom for each target. Also if this config is saved along with the ide project, you wouldn't loose any changes. When say, if you needed to delete the .build folder, due to a monkey update.


FlameDuck(Posted 2011) [#9]
You could save it along with the project files anyway. Simply call it monkey.properties or whatever, point Ant to it, and modify the build script to recognize them as filter values.

I assume the ".build" folder is the result of running Ant against the build.xml for android projects? In which case you really shouldn't be messing with it anyway as it's temporary "by design" (never mind a monkey update, I'm sure there's a "clean" target in there somewhere). You should be messing with ant instead. It's a powerful build tool, designed to automate exactly what you're proposing. It is by far the most advanced technology monkey uses, and the worlds most powerful build system. There is no reason not to use it for this.


Virtech(Posted 2011) [#10]
No, the ".build" folder is generated by monkey regardless of which target you choose. If messing with Ant is your thing you could still edit those files manually if you wish so. Im not talking about replacing every functionality Ant has to offer with a config panel. Just basic stuff like screenres,icons,orientation and the signing process. Eclipse offers a configuration panel that let you tweak parameters like these for Android. I find that very handy.


FlameDuck(Posted 2011) [#11]
Fair enough. Messing with Ant isn't my thing. Messing with Ant is the solution to your thing. For my thing, IntelliJ provides everything I need for Android development (including a namespace aware XML editor).

My point was that your definition of "Basic stuff" doesn't translate across platforms very well. For instance the "icon" for a HTML 5 game (a single windows "ico" format, typically only one in 16x16 resolution) is fundamentally different from the "icon" you need for an Android app (21 different icon configurations in total, 7 different types of icons, for 3 different types of displays, in PNG format), and again for the iPhone which had different types of icons (3 different mandatory types, mostly in different resolutions to the Android ones). For flash it doesn't really matter, for Windows it kinda does (an embedded resource file with different .ico resolution for different icon sizes).

Eclipse can get away with this, because it doesn't need to care about any other icon target than the ones Google specifies. MonkeyIDE/JungleIDE is not so fortunate, unless you want to limit these features strictly to Android users, which I'm sure is going to upset people who develop for other targets, and if you wanted to use Monkey to develop for say both iOS and Android at the same time, you would have to do multiple sets of icons anyway, and the UI would have to account for this scenario, and I think, would very quickly become cluttered.


Virtech(Posted 2011) [#12]
If editing the AndroidManifest means messing with Ant, that's what I've been doing since monkey was released. And I've been doing so for setting things like using native-res, different orientation setups etc. I realize things are different from target to target. That's why I suggested custom config panels across targets, built into the IDE.


therevills(Posted 2011) [#13]
folder named META-INF, which contains the files CERT.SF and CERT.RSA. Delete these. Your app is now unsigned. Using Eclipse is just overkill.


Just tried this and it didnt work... found out that you need to totally delete the META-INF folder from the apk.

Also you need to zip-align the apk.

Quick instructions:

Create the key:
C:\"Program Files"\Java\jdk1.6.0_24\bin\keytool -genkey -alias PirateTriPeaksSolitaire.keystore -keyalg RSA -validity 20000 -keystore keys/PirateTriPeaksSolitaire.keystore

Answer Questions

Sign the apk:
C:\"Program Files"\Java\jdk1.6.0_24\bin\jarsigner -verbose -keystore keys/PirateTriPeaksSolitaire.keystore -signedjar PirateTriPeaksSolitaire-signed.apk PirateTriPeaksSolitaire.apk PirateTriPeaksSolitaire.keystore

Zip align the apk:
C:\"Program Files (x86)"\Android\android-sdk\tools\zipalign -v 4 PirateTriPeaksSolitaire-signed.apk PirateTriPeaksSolitaire-signed-zipped.apk