Written by: Augusto César
One of the biggest problems when developing games for android is, without doubt, the immense range and variety of phones and tablets, actually at the end of last year, the number of devices running android OS was more than 1500!!
Now picture yourself, my dear developer friend, if you want to reach the maximum audience for your game/app, you must make it work on every device, that means you will have to buy all 1500 devices?!
No and yes at the same time. If your app is simple an you are sure that it can run on every device, Android devs can rely on the emulator, which is useful only for emulating various screen sizes, resolutions, aspects, DPI and test how your app reacts on the different sizes.
Our latest game, GalaxyRush, was developed in Unity3D and was impossible, at least in our case, to test the game via android emulator. First of all, because the emulator runs really slowly, even on a top performance PC. And then we have an issue that the emulator is not the real place to test and deeply profile a game. So what we have made, and what decisions we made, regarding the android OS, for this project is what I will try to cover here.
1) Device coverage
Decide if you want quality over quantity, or vice versa. If you chose quality, it means you have more development freedom, and your target is only high end devices that can run heavy graphics, textures and etc.
Taking Galaxy Rush as an example, we chose to target only devices with Android 2.3.3+ OS. By doing this, we automatically eliminated all low, and most of the mid range devices, that wouldn’t run galaxy rush smothlly.
Galaxy Rush is a 2D side scrolling game but all the graphics are 3d models, only the background are images, and there are many models into the game scene at same time. This means that low capacity phones and tablets cannot run this game.
If you want to target low power devices, keep the poly count of your game low, use just a few textures with low resolution. By low I mean at max a 256x256px. NEVER (I really mean never) use textures with alpha, they demand a lot of processing, and will drop the performance of the game significantly.
The code itself is not the heaviest part of the games (generally), so the only things to avoid is using physics. Galaxy Rush is, again, my example. We developed in Unity3D, which has the Nvidia PhysicsX system, for physics simulation. We decided not to use it in this project. Of course, it was not necessary in this type of game, but in code speaking, the most demanding operations are the Physics.
Ok, now we finished the game, what to do?
Using Unity3D, after the game was ready to go to GooglePlay Store, we came across several issues, since building the apk, to uploading the game on Google Play. We don’t want you to have the same problems we had. Here are the Steps we made to make it work out:
First of all, you need to sign your app before uploading them to Google. If you are using Unity, I have bad news We tried for, at least, a hundred times to sign the final apk and without success so we had to sign the apk before it was builded.
Assuming that we are building the unsigned(debug) apk, your Unity3D screen on player setting should look like this:
(for security reasons I won’t be showing our public key)
First step is to choose “Unsigned(debug)” on the Alias menu, that will make the apk unsigned and the version is debug mode, useful only for testing purposes. After that, in Public Key Box, fill in with your developer public key, you obtain that key on your developer console of the Google Play.
Ok now build your APK!
After that, if you try to upload the app, google will pop you a error. It means that the apk is not Signed correctly, or saying that you musn’t upload a Debug version and you will have to correctly sign the apk.
Signing the apk is easy: you have to download the Android SDK and make your CMD on windows, or Terminal on a MAC, visible to the SDK lib, so you can use the commands from the prompt menu.
Now open your CMD.
We need to clear all sign data from the apk and remove the debug version. So use this code on prompt :
zip -d YourApkName.apk “META-INF*”
Now you have to create a valid Keystore. Open the prompt again and use this line of code
keytool -genkeypair -dname “cn=xxx, ou=xxx, o=xx, c=xx”-alias youraliasname -keypass yourpassword -keystore C:\Users\mykeystore -storepass yourstor pass -validity 1000
Now pay attention. On the field “cn”, write the name that you use on Google Play developer console, exactly that name. “ou” stands for Organizational Unit. Write your company name there. On “o”, write your organization name. After that, just change things like your password and you are done creating the key. It should be created on the path you entered before.
After that, you must sign the apk. Now for the code:
jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -yourkeystorename.keystore yourapkname.apk youraliasname
Now, get the names you have created and write them down to the correct spaces. Your apk is now signed correctly!
The last part is to ZIPALIGN the apk. To do so, use this code:
zipalign -v 4 yourapkname.apk yoursignedapkname.apk
Hit enter and there you go! Your apk is ready for deployment. Now just upload it on Google Play and wait for it to be a success!