Android / Step by Step guide to creating a working .APK file.

Posted: January 10, 2015 in android, programming

Right, I have literally spent a whole week reading forum threads and messing about with files and codes etc to try and get a working .apk file for my phone. I have finally succeeded! and hopefully made things easier for people.

I thought I would create a step by step list of exactly how to do it to share with you guys as it seems most people are struggling the same as I did!

In this guide you don’t need to open cygwin once, so no irritating cygwin coding.

Big thanks to Ancient Lady and MissJoJo for helping me with certain problems.

EDIT: I have attached my game app! the .apk file. controls are simple, just tap the screen to make the ball jump over obstacles, the more you jump, the faster it goes!

First off, update to the latest version of AGK (v108) and make sure you have your AGK app finished and ready to go! then follow these steps.

Follow these steps exactly, everything is case sensitive!

1./ Press “START + E” on your keyboard to open windows explorer

2./ double click on your “C:” to open it

3./ make a new folder here called “Android”

4./ download eclipse classic (32bit version NOT 64 even if you have 64bit) from

5./ copy the downloaded ZIP file of eclipse into your “Android” folder and extract it. you should now have a new folder called “eclipse” in your “Android” folder

6./ goto and download the Java SE development kit 7 (JDK 7) for your operating system (can be 32 or 64bit)

7./ install JDK 7


8./ goto the download should start automatically.

9./ once downloaded click on installer_r17-windows.exe to launch the installer (dont just click through! read the next steps!)

10./ on the first screen of the installation make sure it says “Java SE Development kit (JDK) version 7 has been found” – if not then close installation and repeat step 7.

11./ on the next screen of the installation it will ask you for a destination folder, change it to “C:\Android\android-sdk” and click next then install, once the files have finished installing make sure the “Start SDK manager” box is ticked and click “Finish”

12./ The Android SDK manager will now launch, wait for it to fetch all the files, then remove all ticks from all boxes next to the packages

13./ you may have to install an upgrade to Android SDK Tools and Platform (the first 2 tick boxes) so make sure nothing is ticked then tick the “Android SDK Tools” box and the platform one underneath it.

13./ place a tick in the “obsolete” box and tick the “Android 2.3.1” box, and also the Android 3.2 box, and the google USB driver box near the bottom, make sure nothing else is ticked. now click install packages, tick accept all and install.

14./ It will now install the SDK packages, if you see a red error code saying “Stopping ADB server failed”, just ignore it. once done close the SDK manager.


15./ navigate to you C:/Android folder and create a new folder called “Workspace”

16./ navigate to C:/Android/eclipse and double click on eclipse.exe to launch it.

17./ you will see a box asking for a workspace destination folder, click browse and select the newly created “Workspace” folder in your Android folder. tick the “do not ask again” box and click ok.

18./ once the IDE has launched, click on “Help” then “Install New Software”

19./ Click “Add” in the top right corner

20./ in the name field type in ADT plugin

21./ in the address bar underneath type in “” and click ok (if this fails then try “http” instead of “https”)

22./ wait for second for the software to show up then place a tick in “Developer Tools” and click next, accept the terms of license agreements and click on finish, it will start installing the software, if you get a security warning saying the software includes unsigned software then just click ok and let it continue. you may also get a firewall warning, make sure you allow full access if you do.

23./ click restart now when it asks you.

24./ once eclipse has restarted, click “Window” then “Preferences” and click on “Android” from the list on the left. make sure the SDK location is set to “C:/Android/android-sdk” if it isn’t then change it to this location. click ok

25./ click on “Help” then “Install New Software”, at the top there is a drop down menu, click it and select “All Available Sites”

26./ scroll down through the list that it creates until you see “Programming Languages”, click on the expand icon next to it while ensuring that you dont tick the box, now you should see “C/C++ Development Tools”, place a tick next to that and click NEXT

27./ accept agreements and click finish, wait for software to install then click “restart now”, once restarted, close eclipse.


28./ goto and download the “” file

29./ navigate to your C:/Android folder and place this ZIP file in there and extract it


30./ goto and click the hyperlink in the first sentence which says “setup.exe” which will download the file.

31./ run the setup.exe file, click next on the 1st page, on the 2nd click the “install from internet” option and click next

32./ on the next page you will be asked for a root directory, type in “C:/Android/cygwin” – (remember everything is case sensitive), then click next

33./ you will then be asked for the local package directory, change this to “C:/Android/cygpackage”, then click next.

34./ ensure “direct connection” is selected and click on next

35./ click on the 3rd website from the top when it asks you for a download site (they all work, but some are quicker than others, this is the one I used), then click next.

36./ click ok on any alert messages as it downloads.

37./ you will then be shown a window asking you to select packages, type in “Make” in the search box at the top, then click the plus sign next to “Devel” to expand it, near the bottom you’ll see “make: The GNU version of the ‘make’ utility”, click on “skip” to the left of this one so that the numbers 3.82.90-1 are shown. now click next

38./ wait until downloads are finished.


39./ navigate to C:/Android folder and create a new folder called “AGK” (all caps)

40./ open the AGK folder, press START + E to open a new window and navigate to your “C:/program files/the game creators/AGK” folder, copy the folder named “IDE” and paste it to “C:/Android/AGK” folder.


41./ navigate to “C:/Android/AGK/IDE/apps/interpreter_android” folder and right click on the file “HardCodedCompileScript.bat” then select “open with notepad”

42./ highlight all the text and delete it, then paste this

+ Code Snippet

EDIT: capital letter mistake on the Android folder. FIXED

make sure the speech marks are copied at the end of the 2nd and 3rd lines! save and close the file.

43./ now double click the file you just edited, the script should run and automatically compile the project for you, no need for any cygwin coding!


44./ open eclipse again

45./ close the welcome screen, on the left side you should see the package explorer, right click anywhere on this and select “import”, expand the general option and select “existing project into workspace”, click next

43./ Click browse at the top and browse to C:/Android/AGK/IDE/apps/ and select the “interpreter_android” folder, then click ok and finish. you should now see the “AGK Player” folder on the left hand side and also lots of errors!

44./ again, right click on the package explorer and click import, and again existing project into workspace, this time import the folder “C:/Android/AGK/IDE/apps/facebook”, click ok then finish. you should now see “FacebookSDK” on the left side and also some of the errors disappeared!

45./ right click on “AGK Player” in the package explorer and select properties, click on “Java compiler” and UNtick the “enable project specific settings” box at the top, click ok.

46./ Click “File” then “Open File”, navigate to “C:/Android/AGK/IDE/apps/interpreter” and open the file “”, press CTRL + F, type in “#ifdef IDE_ANDROID” and click find, you should see a line of text which says:

+ Code Snippet

delete the “//” at the start to comment this in to the code. click file and then save.

47./ right click the AGK Player file in the package explorer window and click “Android Tools” then click “Fix Project Properties” then click on “Project” at the top and then click “Clean”, make sure “clean all projects” is selected, then click ok. now you should see no errors! any yellow warnings don’t matter.

48./ click on “Run” at the top and then “Run” again. the AGK player is now built!


49./ navigate to “C:/Android/AGK/IDE/apps” and copy and paste the “interpreter_android” folder

50./ rename the copied folder to your games name – with NO spaces.

51./ open up your games folder that you just created, there will be a red file inside with a blank name – “.project”, right click this and open with notepad

52./ on the 3rd line change “AGK Player” to your games name – no spaces. save and close.

53./ right click on the “AndroidManifest.xml” file and open with notepad

54./ read through the code and change ALL instances of “com.thegamecreators.agk_player” to “com.yourcompanyname.yourgamename” – not exactly that text but whatever your company name is and then whatever your games name is, with no spaces! I think there are 8 of these that need changing so look carefully! save, then close.

55./ open up the res folder contained in your games project folder, open the values folder, right click on “strings.xml” and open with notepad

56./ on the 3rd line change “AGK Player” to your games name, here you can have spaces as this is what text is shown on a phone for the app name. save and close.

57./ go back to your games project folder – “C:/Android/AGK/IDE/apps/*gamename*” if there is no folder called “assets” here then create it – case sensitive!

58./ open the assets folder and create another folder called “media” – case sensitive!

59./ press START + E to open a new window and navigate to your AGK project folder – “C:/Program Files/The Game Creators/AGK/Projects/*Basic or native*/*project name*

60./ open the “media” folder and copy everything within this folder and paste it to your “C:/Android/AGK/IDE/apps/*gamename/assets/media” folder

61./ close the “C:/program files/the game creators/agk etc” window if you haven’t already.

62./ navigate to “C:/Android/AGK/IDE/apps/*yourgamename/assets/media” folder and rename the .byc file from your games name to “bytecode.byc”

63./ go back to your games main project folder – “C:/Android/AGK/IDE/apps/*gamesname” and double click the file “HardCodedCompileScript.bat”, wait until it is finished.


64./ navigate to “C:/Android/AGK/IDE/apps/*gamename/src/com/thegamecreators/agk_player” and right click the file “” open with WORDPAD (not notepad)

65./ around line 20 there will be a line that reads:

+ Code Snippet

delete the “//” to comment this in to the code. also, change it to “com.*yourcompanyname.*yourgamename.R” – the same as you typed before in the “AndroidManifest.xml” file, make sure you keep the .R at the end. save it and close.

66./ in the same folder open up “” in WORDPAD, do the same for line 7, delete the “//” and change it to “com.*yourcompanyname.*yourgamename.R”. save it and close.

67./ go to your games main project folder – “C:/Android/AGK/IDE/apps/*yourgamename” and double click the “HardCodedCompileScript.bat”

68./ once that has finished, open eclipse

69./ right click on the package explorer window and click “import”, then click “existing project into workspace” then browse for your games folder – “C:/Android/AGK/IDE/apps/*gamename” and click ok then finish.

70./ right click on your games project folder in the package explorer and click “Android Tools” then click “Fix Project Properties”

71./ click on “Project” at the top then click “Clean”, you should now have no errors.

72./ click on “File” then “Export” then expand the Android option and select “Export Android Application” then click next

73./ select your games project from the browse window and click next

74./ create a new keystore by filling in the details – the location is where you want to store it and the filename, create a password for it and confirm the password, then fill in your details – (the validity MUST be over 50 years. I put 1000 just to be on the safe side.) then select your destination path for the .APK file – you can reuse the keystore for every app you create for android.

75./ you now have a working .apk file! just copy the .apk file to your phone and run it from your phone!, if there are errors then you have either gone wrong somewhere in this list, or there is an error with your AGK code.


* make sure you program in your music and sound files on AGK in the correct casing e.g if the file name is “Music.mp3” then don’t type “music.mp3” type it with a capital M.

* Test your app on as many android devices as possible.

* This help list will only work on Android 2.3.1 or above operating systems




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s