Page 1 of 1

Icons for Android apk?

Posted: Fri May 22, 2015 2:03 am
by fracteed
The only real stumbling block I ran into after working out working the maze that is building for Android apk is getting the icons working.

After replacing the stock ZGE icon (36x36) with my own in the folder at ZGameEditor>Android>Template>base>res>drawable-ldpi and building the apk it works fine, but I would like to get the other icon sizes as well.

I created additional folders in the same ZGE Template location(drawable-hdpi, drawable-mdpi, drawable-xdpi, drawable-xxdpi) at the right specs according to the Google offical docs, but when I build, ZGE strips them out and only leaves the lpdi file. According to Google, you don't actually even need the ldpi anymore, just the 4 others(mdpi (48px)- xxdpi(144px)) a the lpdi is created automatically.

Does anyone know if this is possible with ZGE without hacking the apk file which my invalidate the signing?

Posted: Fri May 22, 2015 1:52 pm
by Imerion
Strange, this worked for me. Perhaps something has changed since then, it was a year ago.
I followed these instructions : viewtopic.php?t=1125&highlight=
But it sounds like what you are already doing.

Posted: Fri May 22, 2015 3:32 pm
by Rado1
I do not think anything has changed in ZGE. Creation of additional directories for resources works fine; I just tested it.

Posted: Sat May 23, 2015 3:54 am
by fracteed
Thanks for the replies guys. Just to be clear , all I am doing is putting the requisite folders into the ZGameEditor>Android>Template>base>res> folder and all icons are the correct size and called "icon.png".

Is there anything I need to do within ZGE itself? I downloaded the latest ZGE beta and tried again, but I still just get the single lpdi folder and icon when I build the apk. I noticed on the ZGE console while it is building the apk, that it just compresses the one icon and doesn't register the others.

I have attached a screenshot of my folder structure to check if I am doing something stupid:

Posted: Sat May 23, 2015 5:21 pm
by Rado1
Hi fracteed, you should put the folders with PNG icons to the generated folder (created after you press Project / Android: Build APK), not to the ZGE folder. The generated folder is used by Android SDK to compile your Android application.

Posted: Sun May 24, 2015 6:58 am
by fracteed
Hi Rado1, I was going to do that, but I didn't think you were meant to tamper with an apk after it had been built?

So, are you saying that after building the release apk with ZGE, that I unzip the apk, then add the png's and re-zip the apk. Doesn't this invalidate the signature or something?

Posted: Sun May 24, 2015 9:11 am
by Rado1
Hi fracteed, here's the process:

1. Open your ZGE project. It has AndroidPackageName set to "com.fracteed.cubenemy".
2. Activate the "Project / Android: Build APK (*)" menu item -> it creates com.fracteed.cubenemy directory.
3. Go to that directory. It contains "res" sub-directory and place your resources there; so there will be, for example, com.fracteed.cubenemy\res\drawable-xxhdpi\icon.png file + plus other files for different resolutions.
4. Run the step 2. again -> it regenerates the application (.apk) with all icons included in -> it is located in the "bin" sub-directory.

BTW you should not change APK file, because there is a checksum and Android installer will consider it as corrupted.

I hope this answer helped.

Posted: Mon May 25, 2015 7:43 am
by fracteed
Aha, yes this works! I never would have guessed that was the workflow, so thanks for the details. I can now cross this issue off my list :D