Building Beta/Release Apk.

Monkey Targets Forums/Android/Building Beta/Release Apk.

Simonsuuri(Posted 2016) [#1]
Howdy, im now at point with my game, to make beta build to google play. and soon Release build..
and I have some questions about it, since I havent found any clear guide to compile for android.

i hope that this topic also helps others with same questions..

1. For Beta build do i need to chance some android target files?
like these ones? and what does these mean?
#ANDROID_APP_PACKAGE="com.monkeycoder.monkeygame"

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

#ANDROID_KEY_STORE="../../release-key.keystore"
#ANDROID_KEY_ALIAS="release-key-alias"
#ANDROID_KEY_STORE_PASSWORD="password"
#ANDROID_KEY_ALIAS_PASSWORD="password"
#ANDROID_SIGN_APP=False

2. Should I make android apk as "release"? and if so, how do I do it?
as much I understand is that even I build "release" version from jungle the apk file will still be "MonkeyGame-debug.apk"

3. when release version is done, where to find it nor what to upload to google play?

4. Im going to need revarding Video Adds for my game.
so is Appodeal module up to date? and good for that?

5. is api_10 ok to use? or should i somehow make newer apk version?


Xaron(Posted 2016) [#2]
Usually I do this key creation and signing stuff by myself. That's how I do it, of course there are other ways but I kept it that way because in the beginning Monkey did not support signing by itself...

1) Add this to your AndroidManifest.xml:
Replace
<application android:label="${ANDROID_APP_LABEL}" android:icon="@drawable/icon">

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


2) Do a release build. The result will still be a MonkeyGame-debug.apk. Don't worry, it's the correct one.

3) Create your key to sign the app. I've created a batch file for this:
"c:\Program Files (x86)"\Java\jdk1.7.0_79\bin\keytool -genkey -alias %1.keystore -sigalg MD5withRSA -keyalg RSA -keysize 1024 -validity 20000 -keystore %1.keystore

Save this as create.bat. Usage: create NAME_OF_YOUR_APP

4) Unzip your apk and delete the folder "META-INF" within it.

5) Sign your apk using this batch file:
"c:\Program Files (x86)"\Java\jdk1.7.0_79\bin\jarsigner -sigalg MD5withRSA -digestalg SHA1 -verbose -keystore %1.keystore -signedjar %1-signed.apk %1.apk %1.keystore
C:\Android\android-sdk\build-tools\22.0.1\zipalign -v 4 %1-signed.apk %1-signed-zipped.apk


Usage: sign NAME_OF_YOUR_APP
You have to adapt the pathes of course...

I don't know anything about video adds. You're fine with API10. It depends what you want to use. When you want to use Admob you have to use a new API level.


Simonsuuri(Posted 2016) [#3]
thanks a lot for your post!

After lots of testing with your batchin system.... (last time I played with .bat files was 12-15 years ago, so it took time to understand what you meant,)
And quite lot of googling / youtubeing about singing apps.I finally understood what key_store / key_Alias / and how to do keystore file. Last part is mostly thanks for Xaron

I was able to wiglle my way to make signed,apk to googleplay and start beta phase for my game..

and how I did it was

1), Editing AndroidManifest.xml in targets folder
Replace
<application android:label="${ANDROID_APP_LABEL}" android:icon="@drawable/icon">

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




2). I made a key to sign the app with code that I found from "Genkey.bat" file from android_target folder
keytool -genkey -v -keystore release-key.keystore -alias release-key-alias -keyalg RSA -keysize 2048 -validity 10000
(Newer versions might have different values)

..And used CMD to run it... with file that Xaron pointed out
"c:\Program Files (x86)"\Java\jdk1.7.0_79\bin\keytool -genkey -v -keystore release-key.keystore -alias release-key-alias -keyalg RSA -keysize 2048 -validity 10000


info:
-keystore "release-key.keystore" is the name of keystore file.. *I kept it like that
-alias "release-key-alias" is a some sort of "sub-name for your key" (not sure tho exactly) * I did chance it to something like "mygame-beta-alias"
-validity 10000 is a measurement how long keystore file will be valid in days... * i chanced it to "36500"

After that peace of code is given to java keytool via CMD; it asks password for KeyStore, and punch of other questions for specializing Signature, after that it asks password To KeyStore Alias..and then some more questions... then it creates file which was chosen at CMD code.. "release-key.keystore" it should be at "\Java\jdk1.7.0_79\bin\ folder...if not any path was given to it...

And I moved my .keystore file to "..\MonkeyXPro85E\Projects\MyGame\ "

3). i chanced build values.. with config commands.. At my GameMain.Monkey file after Import mojo



And after that I builded a version.. If no errors come up, The apk file will be at same old place as usual... but with name Monkey-Release.apk (or something..)
...MonkeyXPro85E\Projects\TheGame\myGame.buildv85e\android_new\bin
*I had problem to find apk file 10 months ago.. :)

Yay!

I Left the META-INF folder in apk. because I think it's the place where sign is made.
With debug build there will be preset signature and thats the reason it needs to be deleted when signing manually??
And since I used monkey builder to sign my apk I assume that there was a correct data in release build

ps.
This was my first "release" build for android so I might be wrong with many things.. so correct me if you know so :)


Simonsuuri(Posted 2016) [#4]
Next Thing Will be after sometime is to make really Final version of my game...

I will Update my monkey version to the latest...

and I need help with Appodeal module or Vungle module and so.
are They UpToDate?
what sort of problems i will find?


Xaron(Posted 2016) [#5]
Glad you sorted it out! :) I was a bit short on time and so was my answer. ;)

Appodeal should work out of the box at least using their standard banners. Never tried interstitials. I know one guy who used Vungle with great success but this was quite a while before. Best is to try. ;)


Simonsuuri(Posted 2016) [#6]
I got Appodeal working, it was quite easy after i found out how to fix it... :)

* i am not writing this from "monkey" computer so i dont get exact version names nor what problems were but here is what i found out..

I am using Monkey 87b since its needed to get appodeal working.
Monkey 87 uses Google Services version "850000" (something like that)
and
Appodeal is using Google Services Version "754000" (something like that)

I had problems that when building with Appodeal module threre was error basicly that "compiler didnt find google-services-version" from Res/values/version.mxl (wich was inside of module)

I tried to fix the problem by chancing version.mxl to Module And Android Target to monkey version (85000..) but then error was that "google services version found 850000.. exepted 754000" then i tried other way round, and i got error ("google-services-version found 0" - exepted 754000)
And after all i fixed it with chancing that version command manually from something like "google-services-version = ~qinteger=google-services-version~q" to "google-services-version=~q754000~q" in appodeal.monkey
where it had #Andoid manifest += commands...

Other things i found out, that was needed to do, wich wasnt included to appodeal "implementation info" (i think)

here is modified tutorial(part 4) from appodeal


And what I used also since appodeal is using Admob also (down know if needed but i think this did something with me)
So I added admob commands also


And basicly it was there... I can see videos and popups as wanted and as much I know it is working with closed beta testers too.

I only hope that, that manually set google services version id (745000 - what is used by appodeal) isnt causing any problems anytime soon :D

One question tho:
I would like to check if there is no internet connetion so i could info player about it when ad-button is clicked... how can i do that?


Xaron(Posted 2016) [#7]
Fantastic, thanks for sharing! :)


Rieha(Posted 2016) [#8]
I would like to check if there is no internet connetion so i could info player about it when ad-button is clicked... how can i do that?


Check this:
http://www.monkey-x.com/Community/posts.php?topic=5783