Programming Games for Android

Programming Games for Android 42: Create APK Game

42 videos

238 minutes

final episode: how to export in Android. We have built the game, and we want to create an APK that we send to our friends or hang on our website, or upload it to the Play Store so that anyone can download from the Google application store. Before exporting, checklist: Step 1, do we have the titles and all the right things? If you have seen the series that went on this same channel on developing applications for Android

You probably know more, but there is a folder called res containing resources used by Android, and what we have to do is make sure that everything is correct. For example, in a file called values ​​strings.xml with strings using our game. One is the name the application and the name you want to display on the home screen. This name is the one I put to build the game and put no spaces

so that things would not break, but still is better if I put spaces, so I'll change it to Jump Do not Die, so it is better written. Step 2, update images. All Android applications have an icon image, which is displayed both on the homescreen, as in the drawer like everywhere. By default we will create one with a default icon Android. We have to put our own. As you see,

we have four versions. It is assumed that each is for a mobile with a different screen density, so that we have from the XXHDPI, that is 144 pixels, used in mobile high density; until MDPI, 48 pixels, shown in devices with a smaller display. HDPI has 72, Xhdpi has 96, and assume that we have to override the four icon of our application, tailored to each platform. I'll reveal

in the Finder so you can edit this quiet, because I have casually designed these resources just now. I have the icon you will use my application, our player; with the appropriate screen resolution for each screen size. The only thing I have to do in my case is overwrite the drawable / folder, remove these resources here, and instead put these four doilies. I bring me and I have it updated.

With this, I have assigned the icon, and we are able to export to Android. Instructions indicating the wiki explains that libgdx you can export with Gradle and a command. Do not take this at face value because you can not import into Android if not the signed application. the firm It is a kind of code that you put your computer as the application developer and is associated with you. The idea is that applications are signed

so they know that you are the author. Whenever you cast an update must bear the same signature, so that you avoid the shock of someone sends you an update that does not carry the same signature and it appears that someone is trying to get a virus. How do we export our game: in Android Studio it is quite simple. In the menu bar we have to click Build> Generate signed APK. With that we generate an APK that is signed. What press,

we say we want to export the module android, we give next, and asks us to create a signature. I already have my own for my other projects but I'll teach you how to create a new one. The first thing I do is create a keystore, which I will give a location, as LlaveroJDD. Will I have to set a password for security. I'll put 123456. By the way, the APK that will be uploaded to the repository obviously does not use this key,

this is for you to understand me. In fact I use another key ... [tipea secret]. So better. Now, I have to create a key in the key. The key contains keys, but no keys keychain worth. Pongo 'Jump Key Do not Die'. I put a password. And I tell you how old I want validity have this key. This is important, as you see put 25, because it is the minimum value that must have applications that let us go to the Play Store,

so that we can provide updates for at least 25 years. When the key expires we can not release updates for our game, which leads me to conclude what will happen in 25 years with all applications available now. But hey, we give a value of 25 years. And if we we want to get more information on the certificate we can do it too. Once we are ready ... I have to put a name. Well, Dani. I do not want to put

personal data now. Once we have we give Next. The next time you want to export we have to get the key, by the way. We say where we want to export the APK as Desktop, and you say I want to Release configuration to export as anything I can throw. I give Finish and begins to export it and to sign it. And once you finish ... [get an error] Uh ... Oh, okay. Where you look, I did not know this. I have to put a

bar before the apostrophe. Note that things did not know this. Now I can not not know. Voucher. It is well know this. Let's see if exported already. And ... well, while this it is doing, I do not know how much it can take. I will take this opportunity to say goodbye, I hope you liked, what you've had a good time and I was useful and now you may have wanted to build applications for Android. You can also build desktop applications, we have been doing all this time,

but I focused on Android because it is a platform on which many people are interested. Once we have finished generating the APK, ready to install, we can copy the mobile and it works. In fact I'm going up to the repository when you upload all code, so you can install it on your mobile and check it out. With these instructions you will have to be able even to make your own game and export it similarly.

And nothing, so far we have come. I hope you liked it, and see you in next series.

To find new courses, subscribe. There will be no spam, promised :)

About the Author

foto de jotajotavm
José Javier Villena

Biography: Analyst-Programmer in different languages. Tutor PREMIUM platforms recognized worldwide as CodigoFacilito. Editor Cristalab articles. My YouTube Channel is sponsored by the ANAYA and LaTostadora publisher. I like to explain in detail and give several examples for the avoidance of doubt.