Singing an App and Release Building

Monkey Targets Forums/Android/Singing an App and Release Building

Paul - Taiphoz(Posted 2013) [#1]
First of all..

Right, Long Story Short [ trying to sign app, wondering what things mean ]

I should also say thanks to therevills as this post by him helped me a lot.
http://www.monkeycoder.co.nz/Community/post.php?topic=1014&post=8800

But it also raised some other questions which I will get into in a second.

Here is my apps key config for reff.
	#ANDROID_KEY_STORE="../../LittleEmber.keystore"
	#ANDROID_KEY_ALIAS="LittleEmber.keystore"
	#ANDROID_KEY_STORE_PASSWORD="*********"
	#ANDROID_KEY_ALIAS_PASSWORD="*********"
	#ANDROID_SIGN_APP=true


Right , Question time.

1. Do those passwords need to be unique.
2. Whats the alias needed for ?

Stuff I wander about while trying all this.

@Therevills, I walked myself through your steps, they seem to have all worked, but at the same time I realized that I had to put the key file in my apps root folder so I could build a release version, do you know, or does anyone know if the version that monkey then creates in the bin folder which I think gets called monkeygame-release.apk is ready for upload to the market, or does it require anything else done to it.

Seeing this in the Debug output.
     [echo] Signing final apk...
 [zipalign] Running zip align on final apk...
     [echo] Release Package: D:\Source\Monkey\Bit-Invader\main.build\android\bin\MonkeyGame-release.apk


So would I be right in saying then , that rather than doing all the zipalign, jarsign stuff manually, its a lot easier to simply copy the key into the root folder and set the sign flag to true ? or does doing it manually ala Therevills post do something different to the files.

Finally, sorry about all the spam.


ziggy(Posted 2013) [#2]
How can I make the keystore file?


ziggy(Posted 2013) [#3]
How can I make the keystore file? Any tips?


therevills(Posted 2013) [#4]
Step 8 creates the key store file.

@Taz, its been a long time since I did that tutorial and I don't know the answers to your questions off the top of my head :-)


Snader(Posted 2013) [#5]
Ziggy, I create the keystore file like this:

C:\"Program Files"\Java\jdk1.6.0_35\bin\keytool -genkey -alias yourProject.keystore -keyalg RSA -validity 20000 -keystore keys/yourProject.keystore

Then answer the questions... and remember your PASSWORD

Then this is the information used in the monkey file

#ANDROID_KEY_STORE="../../yourProject.keystore"
#ANDROID_KEY_ALIAS="yourProject.keystore"
#ANDROID_KEY_STORE_PASSWORD="PASSWORD"
#ANDROID_KEY_ALIAS_PASSWORD="PASSWORD"


ziggy(Posted 2013) [#6]
Thanks! I've managed to sign it.
Also, any ideas how long it takes for the alpha testers link to be created on the google play console? I've done everything like two hours ago and still waiting...

Also, how nasty it is to require a Google+ community for this...

By the way, any ideas why all this are undocumented?

#ANDROID_KEY_STORE="../../LittleEmber.keystore"
#ANDROID_KEY_ALIAS="LittleEmber.keystore"
#ANDROID_KEY_STORE_PASSWORD="*********"
#ANDROID_KEY_ALIAS_PASSWORD="*********"
#ANDROID_SIGN_APP=true


Nobuyuki(Posted 2013) [#7]
1. The alias is used to determine which key to use. A keystore can contain multiple keys depending on the alias. Managing them can be a pain, 'cause you can nuke your keys with keytool by accident, but......

2. It takes up to 48 hours to process changes to your app on Play. Usually changes take in less than 2 hours, unless the app is new; new apps seem to push changes closer to the 8-24 hr period.


I didn't even realize that there were now directives for keystore stuff. Maybe they're too new to be documented. (Directives seem to require manual documentation)


ziggy(Posted 2013) [#8]
I've just found there are also those ones:

#ANDROID_VERSION_CODE="1"
#ANDROID_VERSION_NAME="1.0"

y seeing the CONFIG.monkey file. It would be nice to have a detailed page on the documentation for all this directives.


Loofadawg(Posted 2013) [#9]
Sorry guys for being so daft but I need some extra help. I feel so stupid that I might need How To Publish an Android App Coloring Book. I hope others who are having difficulties and maybe too afraid to ask will once and for all understand after this.


For this test my monkey script is named: "mygame"
and its build folder is located:
"C:\Users\Frank\Desktop\MonkeyPro\mygame.build\"

Java is located:
"C:\Program Files (x86)\Java\jdk1.7.0_45"


Now following these guide lines:

1. Sign up to Android Market developer Console
2. Create your game :)
3. Compile for Android
4. Create your icons as stated by dave.h



Steps 1 thru 4 Easy enough. Check!

5. Alter the APP_LABEL, APP_PACAKGE and SCREEN_ORIENTATION in the CONFIG.TXT

Am I correct in assuming CONFIG.TXT is now CONFIG.MONKEY and is located in
C:\Users\Frank\Desktop\MonkeyPro\mygame.build\android\ ?

If so, inside that file I change these lines:

#ANDROID_APP_LABEL="Monkey Game"
#ANDROID_APP_PACKAGE="com.monkeycoder.monkeygame"
#ANDROID_SCREEN_ORIENTATION="user"					'"user", "portrait", "landscape"


to:

#ANDROID_APP_LABEL="My Game"
#ANDROID_APP_PACKAGE="com.myapps.mygame"
#ANDROID_SCREEN_ORIENTATION="landscape"					'"user", "portrait", "landscape"



6. Compile for Android again

Did that.
It should be normal for the app to still be called:
"MonkeyGame-debug.apk" in the folder.
(And apparently that step is correct because when I transfer
it to my device it shows up as "My Game" and not "Monkey Game" plus it appears to run okay.
Feeling confident.)


7. Find your apk file (yourproject.build/android/bin), open it using WinRAR and delete the META-INF folder (this is where the debug key is stored)

So I opened MonkeyGame-debug.apk with WinRAR (or in my case 7Zip) and deleted the folder META-INF. Now I should I should close 7zip to save the changes after the folder META-INF is deleted.

8. Create the key for your app:
8a. Create a folder called "keytools" and make a folder in that called "keys"


The question I have is where to create it.
I tried creating it in:
C:\Users\Frank\Desktop\MonkeyPro\mygame.build\android\keytools\keys


8b. Open command prompt (cmd.exe)
8c. Navigate to your keytools folder


Navigate to the one I created (and not the folder in java containing keytool.exe):
CD C:\Users\Frank\Desktop\MonkeyPro\mygame.build\android\keytools


8d. Type the following:

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


I typed:

C:\"Program Files (x86)"\Java\jdk1.7.0_45\bin\keytool -genkey -alias mygame.keystore -keyalg RSA -validity 20000 -keystore keys/mygame.keystore


That is where it fails. The output from the command window reads:
Illegal option:  Files


Then the command window proceeds to give the commands for keytool.


So where am I going wrong?


nori(Posted 2013) [#10]
shouldn that be "c:\...." ? with quotes around the whole path


Loofadawg(Posted 2013) [#11]
Not working either.

tried:
"C:\Program Files (x86)\Java\jdk1.7.0_45\bin\"keytool -genkey -alias mygame.keystore -keyalg RSA -validity 20000 -keystore keys/mygame.keystore

But it outputs the command list

Then I tried just because I am going insane:

"C:\Program Files (x86)\Java\jdk1.7.0_45\bin\keytool -genkey -alias mygame.keystore -keyalg RSA -validity 20000 -keystore keys/mygame.keystore"

The system cannot find the path specified.


rIKmAN(Posted 2013) [#12]
tried:
"C:\Program Files (x86)\Java\jdk1.7.0_45\bin\"keytool

Looks like the second " is in the wrong the place, shouldn't it be:
"C:\Program Files (x86)\Java\jdk1.7.0_45\bin\keytool" -genkey.....etc



Volker(Posted 2013) [#13]
Try this:
Copy the keytool.exe to your working path.
Lets say d:\temp.
It works from everywhere.
Create a directory d:\temp\keys
Copy the mygame.apk to d:\temp
Type: keytool -genkey -alias mygame.keystore -keyalg RSA -validity 20000 -keystore keys/mygame.keystore

Does it still fail?


Midimaster(Posted 2013) [#14]
There are two new ways to do it....

1. New way

Very interesting. At the top of this topic Taiphoz descripes a new way, where you can forget "hand made" signing and let it do monkey automatic. He moves the once generated key into the monkey folders and changes some lines in the config. Then a lot of steps are no longer necessary




2. My way

My way is to replace the console writing by using three *.BAT files. One for creating the key (only done once i a live of an app). One for signing it and the third for aligning it.

This BAT files have to be copied in the same folder, where your *.APK is. Then start the first, after this the second and after this the third. And at the end this remove the typing of the console texts:

first BAT:

C:\Programme\Java\jdk1.7.0_45\bin\keytool -genkey -alias MyApp.keystore -keyalg RSA -validity 20000 -keystore keys/MyApp.keystore


second BAT:
cd C:\keytools\
C:\Programme\Java\jdk1.7.0_45\bin\jarsigner -verbose -keystore keys/MyApp.keystore -signedjar MyApp-signed.apk MyApp.apk MyApp.keystore
pause



third BAT:
cd C:\keytools\
C:\Programme\Android\android-sdk\tools\zipalign -v 4 MyApp-signed.apk MyApp-signed-zipped.apk
pause


maybe you need to asign the pathes to your situation.

The complete (but german) tutorial is here:

http://www.blitzforum.de/forum/viewtopic.php?t=39374

I have a folder "keytools" on "C:" and in it another folder "keys". The three BATs are in the "keytools", the *APK is in the "keytools".

Inside the BATs I change the path with "CD" but not again in the following lines...



3. Your code

I think you made errors on the pathes in the scripts. Perhaps the path "Program Files (x86)" makes trouble because there are SPACES in it:
C:\"Program Files"\
           ^   


And also problematic the quotations marks. This is symbolic in the sample and should be replaced by an existing path.
C:\"Program Files"\
   ^              ^   



Replace this by tghe real path to your program folder. Copy the java folder from inside "Program Files (x86)" to direct "C" to have a valid path without SPACES

"C:\Java\jdk1.7.0_45\bin\keytool" -genkey.....etc



Loofadawg(Posted 2013) [#15]
@Midimaster: Thanks for your help. I will do your way after this (or failing trying this way) first. It just annoys me that such simple instructions weren't working for me. This will be a learning experience for everyone and when I successfully do it I will definitely write up a tutorial with pictures and detailed instructions for others. So close!
Please don't think I am unappreciative. Your way looks fool proof with the batch files and easier. Just please bear with me. Thanks :)

@Volker As I said, so close. Got the next step finished. But something screwy on the next step. So this is the progress thus far...

This worked (Thanks rIKmAN):

"C:\Program Files (x86)\Java\jdk1.7.0_45\bin\keytool" -genkey -alias mygame.keystore -keyalg RSA -validity 20000 -keystore keys/mygame.keystore


8e. Answer the questions prompted.

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


So using my previous success as a guideline I typed the following:
"C:\Program Files (x86)\Java\jdk1.7.0_45\bin\jarsigner" -verbose -keystore keys/mygame.keystore -signedjar mygame-signed.apk mygame.apk mygame.keystore


Jarsigner asks and displays the following error:

Enter Passphrase for keystore:
Enter key password for mygame.keystore:
jarsigner: unable to open jar file: mygame.apk


Currently within the command prompt I am still located at:

C:Users\Frank\Desktop\MonkeyPro\mygame.build\android\keytools>


but as jarsigner initially took the passwords I should be in the right place.


Loofadawg(Posted 2013) [#16]
@Midimaster

I see where you say you put the *APK is in keytools folder. Going to try that.

No luck there. Stills say unable to open jar file apk. Weird when you can't figure out why something doesn't work. Initally it was a misplaced quotation mark. Now what. hmmmm...

So can I just copy the JAVA folder, or does it need to be "reinstalled". I know monkey will have to be setup again to find the new location.

Just for reference here's therevills original post:

Really quickly Monkey to Android:

1. Sign up to Android Market Deveoper Console
2. Create your game :)
3. Compile for Android
4. Create your icons as stated by dave.h
5. Alter the APP_LABEL, APP_PACAKGE and SCREEN_ORIENTATION in the CONFIG.TXT
6. Compile for Android again
7. Find your apk file (yourproject.build/android/bin), open it using WinRAR and delete the META-INF folder (this is where the debug key is stored)
8. Create the key for your app:
8a. Create a folder called "keytools" and make a folder in that called "keys"
8b. Open command prompt (cmd.exe)
8c. Navigate to your keytools folder
8d. Type the following:

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



8e. Answer the questions prompted.
8f. Sign the apk:

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



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



9. In the Android Developer Console, click Upload Application
10. Fill out and upload details, screen shots and your signed and aligned apk



Loofadawg(Posted 2013) [#17]
Okay, so I got desperate and followed your steps Midimaster. But still failing on the Jarsigner part.

Unable to open jar file: mygame.apk

So I renamed the apk from

MonkeyGame-debug.apk


to

mygame.apk


And that appeared to work. I guess that is where I went wrong, but I did not see instructions to rename the apk yet.

Just need verification that I am doing the right things thus far.


Midimaster(Posted 2013) [#18]
sorry, that was my mistake... I forgot to tell you ,that it is of course necesarry to rename the app before starting the procedure.

The german tutorial is much more detailed. The "mygame" in the instructions is only a placeholder for the real and final name you want to publish the app.


I have one final question: Was it necessary to copy the java folder to "C:\" to have a path without SPACE? Or did it at the end work with the "C:\Program Files (x86)\..." too?


Fred(Posted 2013) [#19]
I might not understand your needs well but since 1 or 2 versions of Monkey you don't need to do all this.

Create your keystore file once with keytools -genkey... as described, put it in your sources folder just above the build folder and use this in your main monkey file (change the app name for your needs)

#ANDROID_APP_LABEL="PopCorn 1988"
#ANDROID_APP_PACKAGE="fr.ludoid.popcorn"
#ANDROID_KEY_STORE="../../PopCorn1988.keystore"
#ANDROID_KEY_ALIAS="PopCorn1988.keystore"
#ANDROID_KEY_STORE_PASSWORD="your_password"
#ANDROID_KEY_ALIAS_PASSWORD="your_password"
#ANDROID_SIGN_APP=True

and the app is automaticaly signed for every compil and it works on the device while working.

Then you need to rename the MonkeyGame-release.apk file only when submitting it.


Loofadawg(Posted 2013) [#20]
@Fred Thanks. I will be trying that shortly. So the main monkey file
is the same monkey file as my app, right? (stupid question I know, just making sure) Just copy it into the top of the file somewhere.

#ANDROID_APP_LABEL="My Game"
#ANDROID_APP_PACKAGE="com.myapp.mygame"
#ANDROID_KEY_STORE="../../mygame.keystore"
#ANDROID_KEY_ALIAS="mygame.keystore"
#ANDROID_KEY_STORE_PASSWORD="my_password"
#ANDROID_KEY_ALIAS_PASSWORD="my_other_password"
#ANDROID_SIGN_APP=True

#ANDROID_SCREEN_ORIENTATION="user"

Import mojo

Class Game Extends App

etc...


Then compile, eh? Seems easy enough.

@Midimaster I tried both ways and they both work. :)
One quote in the wrong place will screw it all up.


Anyways guys. I did all the steps - finally.
BUT..

When I try to install mygame-signed-zipped.apk to my phone I get the following error message

X Application not installed

Of course since I am not sending this in yet to the Playstore I not going
to upload it there yet, but it should work on my device shouldn't it?


Sorry guys for being such a pain. Between my son's school activities (he's a senior this year!) and work I have only precious few moments to do this and it's driving crazy. LOL. Almost there. Need to figure out why the "finished" product won't install now.


Fred(Posted 2013) [#21]
yes your mygame.monkey file. The codebox code is fine. (both passwords can be the same)

Can you run directly your program to your device from Monkey IDE ?


Midimaster(Posted 2013) [#22]
It is not necessary to do all this steps to get your app on the phone!
These steps are only necessary, if you want to publish your app.

Only connect your phone via USB with the computer and run F5 in Monkey. The app will start on the phone after some seconds of installation.

Did you test your app already on Html5?

Did you already install the correct USB driver for your phone?

Did you already set the developer settings on the phone?

Did you already test the connectivity of your phone with a 100% perfect working app?

here is my "minmal test app".




Loofadawg(Posted 2013) [#23]
I didn't set it up that way. Not yet. But I familiar with it.

On my laptop as soon as it compiled monkey would transfer the apk
to my Galaxy S Captivate through the usb cable.

But now I am making the transition to the our Windows 8 Desktop. It has probably been a year since I touched my monkey LOL so I am playing catch up during this phase. (So again, I appreciate everyone's understanding with all the freaking questions and confusion. You guys are the best!)

Currently I just drop the apk in dropbox and install it once it refreshes.

But that shouldn't be a problem I wouldn't think as the apk installs before I did the signing and aligning.

I am going to try again with a fresh build and do it all in one sitting tomorrow if I get a chance. I may have inadvertently caused the problem with file getting screwy.


Loofadawg(Posted 2013) [#24]
@Midimaster

No worries. I can get the apks I compile with monkey onto my phone easy enough and they work.

I am in the process of finally getting an app published onto the market that's where you guys come in and have been most helpful. Thanks again. :)

But as I said. After successfully working all the steps, the apk which worked previously in HTML and my phone will now no longer install after being the final two steps.

Weird, huh?

So I will attempt again with a fresh build at a later time and hopefully it will all work out.

I hope that all makes sense now. :)


Midimaster(Posted 2013) [#25]
Ok... I now tried the new way with signing direct in Monkey for the first time.

How do I know, that it worked? Can I check anywhere or anyhow, whether the signature is the original monkey default signature or mine?



I tested to compile my app with right and wrong password line:
#ANDROID_KEY_STORE_PASSWORD="correct"
#ANDROID_KEY_STORE_PASSWORD="wrong"



In both the process run sucessful!!! without any error message and in both the apk message was:

-package:
[apkbuilder] Current build type is different than previous build: forced apkbuilder run.
[apkbuilder] Creating MonkeyGame-debug-unaligned.apk and signing it with a debug key...



Gerry Quinn(Posted 2013) [#26]
I am baffled too - I tried it and though I think my code is correct the META-INF folder in the APK seems to contain an unnamed CERT and RSA. When I do it the long way in the command line, they are given the name of the keystore.

Sticking to the manual method for now...


Supertino(Posted 2014) [#27]
For whats it's worth this all seems to work fine via Monkey for me using a keystore file I a created some time ago. Before the signing was added to monkey I used this .bat file.

1. Delete the META_INF from the apk
2. Put the apk and keystore file in the same location as the bat file
2. Run the bat and answer the questions

@echo off
Title Sign an unsigned apk
set OLDDIR=%CD%


cls
echo.
echo You will need to copy your keystore file
echo eg. my-release-key.keystore
echo into the same folder as this script.
echo.
echo Please place your unsigned app in the same 
echo directory as this program, when you have
echo done this please type in its name below:
echo.
echo.
set /p apk= What is the filename (including the .apk at the end)?  
echo Your app is named %apk% 
echo.
echo.
echo while creating your Private Key, what did you put as your ALIASNAME?
set /p alias= Aliasname 
echo. 
echo Is the Java JDK in your path?
echo if you do not know what this means, please type "N"
CHOICE /C:YN /M "Java JDK in path?"
If errorlevel 2 goto nojdk
If errorlevel 1 goto jdk

:nojdk
echo.
echo.
echo It is recommended that you put the jdk in your path
echo To see how please visit this web page:
echo http://www.oracle.com/technetwork/java/javase/documentation/install-windows-152927.html
echo.
echo.
pause
cls
echo.
echo.
:jdk
echo ok, you will need to type in your password when prompted

jarsigner.exe -verbose -keystore  my-release-key.keystore %apk% %alias%
echo.
echo. 
echo Checking it is signed correctly
jarsigner -verify %apk%
echo.
echo If you got an error you probably
echo compiled your apk with a key
echo (probably the debug key).
echo Try recompiling it without signing
echo and then copy and paste the
echo resulting temp.ap_ file here.
echo.
echo.
echo Now we just need to zipalign the apk
echo. 
echo.
echo.
set /p final= What do you want the finished apk to be called?:     
echo %final% it is
echo. 
pause
zipalign -v 4 %apk% %final%
echo.
echo.
pause
cls
Pause



trainer(Posted 2014) [#28]
Hello guys,
I'm trying to publish apk file to google play,
I made a little change at CONFIG.MONKEY file, which is like this:


and the out put is fail:


with out this change, I got my apk file and I followed the instructions of loofa
I got three files at toolskey which is:


and I uploaded the mylittleworld.signed.zipped.apk at google market and I got this fail uploaded,

any idea plzzz!!!!!!!!!!!!!!!


Midimaster(Posted 2014) [#29]
there are a lot of reasons, why I could fail... What was the error message GooglePlay returnend to you?

The latest news are, we have to change something in the android.manifest:

${ANDROID_MANIFEST_MAIN}
	<application android:label="${ANDROID_APP_LABEL}" android:icon="@drawable/icon" android:debuggable="false">


Did you already think about this?


trainer(Posted 2014) [#30]
where is this file ?
If u mean androidManifest.xml ..!!
this line is not there, android:debuggable="false">



there is only,,


Plz replay me ASAP


Midimaster(Posted 2014) [#31]
I always use the "old school" way to sign my apps. It is a long way, but it works 100%. And it is on Win PC. There are already some short tutorials about this way here.

But in this tutorial a new additional information is missing. That what I was talking about. The "android.manifest.xml" need to have the debug information in the line line you found.

instead of....

${ANDROID_MANIFEST_MAIN}
	<application android:label="My LittleWorld" android:icon="@drawable/icon">


it now need this:

${ANDROID_MANIFEST_MAIN}
	<application android:label="My LittleWorld" android:icon="@drawable/icon" android:debuggable="false">



Volker(Posted 2014) [#32]
Have you created your keystore file and placed it in the main directory of your project?

Have your changed this lines in config.monkey?

#ANDROID_APP_LABEL="Yourgame"
#ANDROID_APP_PACKAGE="com.yourcompanyname.yourpackagename"

#ANDROID_KEY_STORE="../../Yourgame.keystore"
#ANDROID_KEY_ALIAS="Yourgame.keystore"


trainer(Posted 2014) [#33]
excuse me, can u plz explain to me, what shall keystore file have inside it ???
shall I make any thing inside it ??

I didn't get my release apk file yet,:""(

I made the changes u tell at CONFIG.MONKEY



PLz I dk where is the error, and this made me crazy, I need ur help, :""""(


Volker(Posted 2014) [#34]
The keystore fike is created in step 8 here:
http://www.monkeycoder.co.nz/Community/posts.php?topic=5787&post=69971
No, you do not have to make anything in it.
Put it in the main directory of your project.
Your config.monkey looks ok. More later, because I am not at home.


Volker(Posted 2014) [#35]
In your config.monkey you have to set
#ANDROID_SIGN_APP=true
If you have set your password although
#ANDROID_KEY_STORE_PASSWORD="yourpassword"
#ANDROID_KEY_ALIAS_PASSWORD="yourpassword"

you can compile your project and it shout build in your .build/android/bin folder
a "MonkeyGame-release.apk".


trainer(Posted 2014) [#36]
I did that, it is also not working


Volker(Posted 2014) [#37]
What is not working? Do you have a "MonkeyGame-release.apk"? Which error message? Give us more infos.
There is one more step needed to upload it, but let's do it step for step.


trainer(Posted 2014) [#38]
Ok I will explain what I did, step by step
I finished my game programming, I run it, then I got my "MonkeyGame-debug.apk" at this location :
C:\Users\toshiba\Desktop\Monkey_Programing\game_final_stages\FANAL_GAME\Final_g.build\android\bin\

I went to bulid of my game and I opened "CONFIG.MONKEY"
package="com.monkeycodr.monkeygame package="com.sutism.MyLittleWorld"
#ANDROID_APP_LABEL="Monkey Game" (to) #ANDROID_APP_LABEL="My Little World"
#ANDROID_APP_PACKAGE="com.monkeycoder.monkeygame"
(to)
#ANDROID_APP_PACKAGE="com.autism.mylittleworld"
saved it and closed,

and I set up the icons at "res file" at this location:
C:\Users\toshiba\Desktop\Monkey_Programing\game_final_stages\FANAL_GAME\Final_g.build\android\res
Then I closed monkey and opened it again and run again, and I got alterable "MonkeyGame-debug.apk"
I test it at my Samsung Galaxy devices it worked very well,,
Now Publishing time:
To publish I need release not debug apk
So I went to CONFIG.MONKEY and made those changes:
#ANDROID_KEY_STORE="../../mylittleworld.keystore"
#ANDROID_KEY_ALIAS=" mylittleworld.keystore "
#ANDROID_KEY_STORE_PASSWORD="12345"
#ANDROID_KEY_ALIAS_PASSWORD="12345"
#ANDROID_SIGN_APP=True
And I created a file called "keystore" and I placed it at this directory :
C:\Users\toshiba\Desktop\Monkey_Programing\game_final_stages\FANAL_GAME
I opened the monkey and run the game in release mode and I got this failed output:



I'm so sorry, I bothered u guys with this, I'm very thankful to u :)


Volker(Posted 2014) [#39]
[quote]And I created a file called "keystore" and I placed it at this directory [quote]
How did you create it?
Using this: http://www.monkeycoder.co.nz/Community/posts.php?topic=5787&post=69971
step 8a until 8e?
Looks like it can't be signed because of the keystore file.


trainer(Posted 2014) [#40]
I didn't created it by the way of loofa coz it can't be done with me too,
after I answers the questions and rewrite the password, it gaves me keytool error: java.io.FileNotFoundException: key\mylittleworld.keystore


I just created it by the old way, new - folder - and I named it as keystore, I know this is stupid, but I really cann't find way to make it success


Volker(Posted 2014) [#41]
Try to run the command prompt as administrator.
If you are using windows7, you can go to run, type cmd and hit Ctrl+Shift+enter. This will open the command prompt in administrator mode. If not, you can also go to start -> all programs -> accessories -> right click command prompt and say run as administrator.


trainer(Posted 2014) [#42]
I tried, also I got the same mes

I will try until it will work, I will post my succese after I find the reason behinde the failed

Thank you :)


Volker(Posted 2014) [#43]
I found a tool, AppToMarket. Haven't tested everything, but at least, you can create a keystore file under "Certifcate Details"
If you get it working, it may help you.
http://code.google.com/p/apptomarket/downloads/detail?name=AppToMarket_v32.zip&can=2&q=


Gerry Quinn(Posted 2014) [#44]
This is somebody's instruction from a year or two ago for the old-school method, sorry I can't remember who wrote it:

Really quickly Monkey to Android:

1. Sign up to Android Market Deveoper Console
2. Create your game :)
2.5 Add android:debuggable="false" to the application section of the manifest in build/templates
3. Compile for Android
4. Create your icons as stated by dave.h
5. Alter the APP_LABEL, APP_PACAKGE and SCREEN_ORIENTATION in the CONFIG.TXT
5. [Note: you can do this via the pre-processor now, I couldn't get signing to work but these work fine, along with version etc.]
6. Compile for Android again
7. Find your apk file (yourproject.build/android/bin), open
it using WinRAR and delete the META-INF folder (this is where the debug key is stored)
8. Create the key for your app:
8a. Create a folder called "keytools" and make a folder in that called "keys"
8b. Open command prompt (cmd.exe)
8c. Navigate to your keytools folder
8d. Type the following: [to generate key]
C:\"Program Files"\Java\jdk1.6.0_24\bin\keytool -genkey
-alias yourProject.keystore -keyalg RSA -validity 20000
-keystore keys/yourProject.keystore
8e. Answer the questions prompted.
8f. Sign the apk:
C:\"Program Files"\Java\jdk1.6.0_24\bin\jarsigner -verbose
-keystore keys/yourProject.keystore -signedjar
yourProject-signed.apk yourProject.apk yourProject.keystore
8g. Zip align the apk:
C:\"Program Files (x86)"\Android\android-sdk\tools\zipalign
-v 4 yourProject-signed.apk yourProject-signed-zipped.apk
9. In the Android Developer Console, click Upload Application
10. Fill out and upload details, screen shots and your signed and aligned apk


I added 2.5. You may have to change the paths in the commands.


dave.h(Posted 2014) [#45]
I can confirm that the above still works fine as ive just submitted a new android app today using the above method.


trainer(Posted 2014) [#46]
PUBLISHING ANDROID APP USING MONKEY:

1. First check if you have jdk1.6... version. Set a path JAVA_HOME to jdk1.6... in the Environment variables. If there are many paths to jdk, ensure that the path to jdk1.6... is the first path. (Because JDK7 creates some signing problem).

2. Change the application label and application package in the CONFIG.txt file inside the build\android folder. Example if my game is a car game, set the following,

ANDROID_APP_LABEL="Car Game"
ANDROID_APP_PACKAGE=com.cargame.gameworld

Also add the following line
ANDROID_GAMEPAD_ENABLED=false

(Note: After removing this line, when I compiled and installed the app in the device, it showed the error "app stopped unexpectedly". When I added this line and compiled and installed, this error did not show up. But I am not sure if there is a link between this line and the error).

3. Place the application icons inside build\android\res folder :- drawable-hdpi (icon size 72x72), drawable-ldpi (icon size 36x36) and drawable-mdpi (icon size 48x48).

4. Create a keystore file:
Type cmd in search box at the start menu.
Right click cmd and click Run as administrator

In the command window, go to C or D or any drive. For example to create the keystore file in E drive, type the following in the command window.
>cd \
>E:
Then type,
E:\>keytool -genkey -alias anyname.keystore -keyalg RSA -validity 20000 -keystore anyname.keystore

Example: If we want to use the name cargame then we have to type,
E:\>keytool -genkey -alias cargame.keystore -keyalg RSA -validity 20000 -keystore cargame.keystore

(Note: This will work only if have an environment variable set to jdk - see step no. 1).

Then type the details - your name, your organization etc. - the details are just used to create a unique signature - so don't worry much about the details. Keep note of the passwords you type.

This will create cargame.keystore in the E drive.

5. Tell the location of your keystore file to your project. To do this, open the ant.properties file inside build\android folder. Add the following 2 lines to the end of the ant.properties file as shown below.

key.store=E:\\cargame.keystore
key.alias=cargame.keystore

Note: There is double backslash after a folder name. There is no single or double quotes for the values.

6. If you want to change the name of your release apk file, for example like CarGame-release.apk instead of MonkeyGame-release.apk, then open the build.xml file inside the build\android folder. Now change the project name to the name you want. For example,

<?xml version="1.0" encoding="UTF-8"?>
<project name="CarGame" default="help">

7. If you are updating your game (publishing for the second time) then you need to change the version code and version name of the game. To do this:
Browse to the android folder inside the build folder.
Open the AndroidManifest.xml file and change the version code and version name. For example to change the version code to 2 and version name to 1.1, set them in android:versionCode and android:versionName as shown below.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="com.cargame.gameworld"

android:versionCode="2"
android:versionName="1.1"
android:installLocation="auto">
...............

8. Now we are going to create the release apk. Open the command window as administrator. (See step 3). Browse to your android folder.
For example if my game is inside C: drive
>cd\
C:\>cd gamefolder
C:\gamefolder> cd game.build-folder
C:\ gamefolder\game.build-folder> cd android
C:\ gamefolder\game.build-folder\android>

Now type ant release

C:\ projectfolder\game.build-folder\android>ant release

When it prompts to enter the passwords, type the passwords you used while creating keystore file.

Thats all, you will have your project-name-release.apk inside build\android\bin folder. Upload this apk file in Google market. (Before uploading, install the app in mobile device and test it).

(Note: If the ant command does not work, you need to set ANT_HOME in the environment variables. Find the location of your apache-ant-version folder in your computer and create a new variable in the environment variables, for example, Variable Name ANT_HOME Variable Value C:\apache-ant-1.8.2).

Hope this helps.

Contact:gp1433@...


trainer(Posted 2014) [#47]
PUBLISHING ANDROID APP USING MONKEY:

1. First check if you have jdk1.6... version. Set a path JAVA_HOME to jdk1.6... in the Environment variables. If there are many paths to jdk, ensure that the path to jdk1.6... is the first path. (Because JDK7 creates some signing problem).

2. Change the application label and application package in the CONFIG.txt file inside the build\android folder. Example if my game is a car game, set the following,

ANDROID_APP_LABEL="Car Game"
ANDROID_APP_PACKAGE=com.cargame.gameworld

Also add the following line
ANDROID_GAMEPAD_ENABLED=false

(Note: After removing this line, when I compiled and installed the app in the device, it showed the error "app stopped unexpectedly". When I added this line and compiled and installed, this error did not show up. But I am not sure if there is a link between this line and the error).

3. Place the application icons inside build\android\res folder :- drawable-hdpi (icon size 72x72), drawable-ldpi (icon size 36x36) and drawable-mdpi (icon size 48x48).

4. Create a keystore file:
Type cmd in search box at the start menu.
Right click cmd and click Run as administrator

In the command window, go to C or D or any drive. For example to create the keystore file in E drive, type the following in the command window.
>cd \
>E:
Then type,
E:\>keytool -genkey -alias anyname.keystore -keyalg RSA -validity 20000 -keystore anyname.keystore

Example: If we want to use the name cargame then we have to type,
E:\>keytool -genkey -alias cargame.keystore -keyalg RSA -validity 20000 -keystore cargame.keystore

(Note: This will work only if have an environment variable set to jdk - see step no. 1).

Then type the details - your name, your organization etc. - the details are just used to create a unique signature - so don't worry much about the details. Keep note of the passwords you type.

This will create cargame.keystore in the E drive.

5. Tell the location of your keystore file to your project. To do this, open the ant.properties file inside build\android folder. Add the following 2 lines to the end of the ant.properties file as shown below.

key.store=E:\\cargame.keystore
key.alias=cargame.keystore

Note: There is double backslash after a folder name. There is no single or double quotes for the values.

6. If you want to change the name of your release apk file, for example like CarGame-release.apk instead of MonkeyGame-release.apk, then open the build.xml file inside the build\android folder. Now change the project name to the name you want. For example,

<?xml version="1.0" encoding="UTF-8"?>
<project name="CarGame" default="help">

7. If you are updating your game (publishing for the second time) then you need to change the version code and version name of the game. To do this:
Browse to the android folder inside the build folder.
Open the AndroidManifest.xml file and change the version code and version name. For example to change the version code to 2 and version name to 1.1, set them in android:versionCode and android:versionName as shown below.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="com.cargame.gameworld"

android:versionCode="2"
android:versionName="1.1"
android:installLocation="auto">
...............

8. Now we are going to create the release apk. Open the command window as administrator. (See step 3). Browse to your android folder.
For example if my game is inside C: drive
>cd\
C:\>cd gamefolder
C:\gamefolder> cd game.build-folder
C:\ gamefolder\game.build-folder> cd android
C:\ gamefolder\game.build-folder\android>

Now type ant release

C:\ projectfolder\game.build-folder\android>ant release

When it prompts to enter the passwords, type the passwords you used while creating keystore file.

Thats all, you will have your project-name-release.apk inside build\android\bin folder. Upload this apk file in Google market. (Before uploading, install the app in mobile device and test it).

(Note: If the ant command does not work, you need to set ANT_HOME in the environment variables. Find the location of your apache-ant-version folder in your computer and create a new variable in the environment variables, for example, Variable Name ANT_HOME Variable Value C:\apache-ant-1.8.2).

Hope this helps.

Contact:gp1433@...


trainer(Posted 2014) [#48]
Because signing with JDK7 creates a problem while the user downloads the game:
If you have JDK7 in your computer, add the following to the build.xml file inside the android folder and then make the release version.

<presetdef name="signjar">
<signjar sigalg="MD5withRSA" digestalg="SHA1" />
</presetdef>

Note: I have not tried this solution. I found it while browsing. If anyone use this solution and is successful, please post here.

gp1433@...