Posted: 30th May 2012 17:45
Due to the difficulties I was having getting Tier 2 to work, Errors with trying to compile with CYGWIN, and the some what confusing nature of the guide provided, I decided to write a little tutorial now that I got things working. For reference I am on a computer with Windows XP SP3, and using v1065 of AGK. At the moment I recomend using v1065 as I belive that was part of the problems that were happening.
A lot of this information is in the Guide provided in the documentation. The guide was a bit confusing / un-orginized and I hope this makes things a little easier to follow.
This is a step by step guide to setup AppGameKit, Android SDK / NDK, Eclipse, and CYGWIN. Also will go into how to start using Tier 2 and compile with CYGWIN to deploy to Android.
If you have previously installed any of these programs and are running into problems, I recomend uninstalling all of them, including any left over folders, and starting fresh following this guide. This is what I did and whatever went wrong originally was fixed by doing all of the following.
----------------------------------------------------------------
PART 1: Downloading, Installing, and Setup
----------------------------------------------------------------
STEP 1: Download
First thing you will need to do is download the following programs.
AGK v1065 - http://www.thegamecreators.com/
Android SDK - http://developer.android.com/sdk/index.html (installer_r18-windows.exe)
Android NDK - http://developer.android.com/sdk/ndk/index.html
Eclipse IDE - http://www.eclipse.org/downloads/ (choose 'Eclipse Classic')
CYGWIN - http://cygwin.com/install.html ('Setup.exe' Hyperlink at top of page.)
STEP 2: AppGameKit Installation
- Run the AppGameKit setup program, 'AppGameKit1065.msi'
- Agree to the Licence Agreement.
- Enter your Serial Number.
- Choose the default location to install to. 'C:\Program Files\The Game Creators\'
- Once done installing, click finish. AppGameKit is now installed.
STEP 3: Android SDK Installation and Setup
- Run the Android SDK setup program, 'installer_r18-windows.exe'
- It will begin by looking for the Java SDK, if you do not have it installed it will be installed.
- Choose a location to install to, Default: 'C:\Program Files\Android\android-sdk'
- You will be asked where you want it on your start menu, or you can choose 'do not create shortcuts' check box if you like.
- Click Install.
- Once done, click next, be sure the check box 'Start SDK Manager' is checked and click finish.
- The SDK Manager will start.
- Un-Check the 'Android 4.0.3 (API 15)' Check Box.
- Click the 'Obsolete' Check Box.
- Click the 'Android 2.3.1 (API 9)' Check Box.
- Click 'Install Packages'
- You will be asked to confirm the packages to install, if there are any with a Question Mark, Select them and click 'Accept'.
- Click Install.
- Android SDK Manager will begin Downloading / Installing the Packages.
- Once the SDK Manager is done, you may close the SDK Manager Window.
- The Android SDK is now Installed and Setup.
STEP 4: Eclipse Installation and Setup
- Open the Eclipse .ZIP File and Extract to the location you want. I chose 'C:\eclipse\'
- Open the Folder you extracted the files to and Run 'Eclipse.exe'. (You may want to create a shortcut for Eclipse on your Desktop at this point to save time and make it easier to access.)
- You will be asked where you want your workspace to be located, choose a location and click 'Ok'.
- You now need to install the Android Development Tools Plugin for Eclipse.
- From the top Menu select Help -> Install New Software
- Click the 'Add' Button in the upper right hand corner.
- Enter 'ADT Plugin' in the Name Field.
- Enter 'https://dl-ssl.google.com/android/eclipse/' in the Location field and click 'Ok'
- After a moment, you should see 'Developer Tools'. Click the Check Box for it and then Click 'Next'.
- You will be asked to review the items to be installed, Click 'Next'.
- Click 'I accept the Terms of the Liscense Agreements' and then 'Finish. If you get a warning saying that the authenticity or validity of the software can't be established, Click 'Ok'.
- Once done, you will be asked to Restart Eclipse, Do so.
- When Eclipse restarts, It will ask to configure the Android SDK.
- Choose 'Existing SDK', then Choose the Location you installed the Android SDK to. Default was:
'C:\Program Files\Android\android-sdk'. Click 'Next' and then 'Finish'.
- Now you need to install the 'C/C++' Plugin for Eclipse.
- From the top Menu select Help -> Install New Software
- To the left of the 'Add' Button is a Drop Down List. From it select 'Indigo - http://download.eclipse.org/releases/indigo'.
- Expand the 'Programming Languages' Selection and Click the 'C/C++ Development Tools' Check Box. Click 'Next'
- You will be asked to review the items to be installed, Click 'Next'
- Click 'I accept the Terms of the Liscense Agreements' and then 'Finish.
- Once done, You will be asked if you want to restart now. You can, or you can do so later.
- Eclipse is now Installed and Setup.
STEP 5: CYGWIN
- Open the CYGWIN setup program. 'Setup.exe'
- Choose 'Download from the Internet', Click 'Next'
- Choose a location to install to. Default: 'C:\cygwin', Click 'Next'
- You will be asked for a temporary location to download installation files to. I chose a 'temp' folder on the Desktop. Click 'Next'
- Choose a Mirror to download from and Click 'Next'
- You may get a 'Setup Alert' Window, click 'Ok'
- A 'Cygwin setup - Select Packages' screen should appear. If not run the 'Setup.exe' Program again to bring it up.
- In the Search field Enter 'MAKE'.
- Expand the Devel Selection. Select 'make: The GNU version of the 'make' utility'. (There is a little arrow/circle icon next to the word Skip, Click it once to Select it.), Click 'Next'
- Cygwin will begin Downloading and Installing.
- Once complete you can choose to create icons and Click 'Finish'
- CYGWIN is now Installed and Setup.
- (NOTE: You may delete the 'temp' folder now.)
STEP 6: Misc. Folder Setup
This step is to setup an Android folder from an easilly accessible place, such as 'C:\' to make compiling your Android Programs easier. It is important to note that these folders should not contain any spaces. CYGWIN is case sensitive and does not like spaces in file paths. CYGWIN is a terminal style program, meaning you will need to type everything, so choosing short path names will make things easier for you later on.
You will also be copying some AppGameKit folders here to make compiling easier and to eliminate spaces.
- Create a New Folder in 'C:\' and name it 'android'.
- In 'C:\android' Create a New Folder and name it 'AGK'.
- Goto your AppGameKit Folder 'C:\Program Files\The Game Creators\AGK'
- Copy the folder 'IDE'
- Paste this folder in 'C:\android\AGK'
- Your android folder is now setup.
STEP 7: Android NDK Setup
- Open the Android NDK .ZIP File.
- Extract it to your 'C:\android' folder.
- You should now have a folder in 'C:\android' called 'android-ndk-r8'.
- The Android NDK is now Setup.
----------------------------------------------------------------
PART 2: Tier 2
----------------------------------------------------------------
This guide assumes you allready have VC++ Installed, I am using VC++ 2010 express, so some of
this information may not apply.
PART 1: AppGameKit Wizards
- Navigate to 'C:\Program Files\The Game Creators\AGK\IDE\Utilities\AGKWizard'
- There is a PDF file in this folder with installation instructions if you wish to read that.
- If you are using Windows XP then go into the folder AGKWiz, If using Windows 7 go into the folder AGKWiz_x86.
- Copy the folders in this directory.
- Navigate to your VC++ Installation folder, by default, Windows XP 'C:\Program Files\Microsoft Visual Studio 10.0\VC' or for Windows 7 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC'.
- Paste the files you copied into this folder. You may be asked 'this folder already contains a folder by that name, do you want to overwrite?', Click 'yes'.
- If you are using the Express version of VC++, you will also need to copy the Folder 'VCProjects' to the 'Express' Folder.
- The AppGameKit Wizards are now Installed.
PART 2: Using the AppGameKit Wizard
- Open VC++, If you are not prompted to start a New Project, Select File -> New -> Project from the top Menu.
- Select AppGameKit Wizard.
- Enter a Name for your project.
- For Location, Use either 'C:\Program Files\The Game Creators\AGK\IDE\apps\' or 'C:\Program Files\The Game Creators\AGK\IDE\templates\'.
- Make sure the check box 'Create Directory for Solution' is checked. Click 'Ok'
- You will be asked for some information about the Window Size of your application, Enter what you would like or just use the Default of 640 x 480. Click 'Finish'
- Once created you can try running the program.
- If you receive the error 'LINK : fatal error LNK1104: cannot open file 'atlsd.lib'', Select your project and then select Project -> Properties from the top Menu.
- Expand the 'Configuration Properties' Selection.
- Expand the 'Linker' Selection. Select Input.
- In the Box Labeled 'Ingore Specific Default Libraries' Enter 'atlsd.lib'. Click 'Ok'
- You can now try running again and all should work.
- You can now begin editing the File 'Main.cpp' to make your program.
- (NOTE: due to the way the libraries are linked in the Wizard, you must set the location you create the project correctly. You can set the Location some place else, but there are more steps involved with correcting the library direcories.)
PART 3: Tier 2 - Template Method
If you choose not to use the wizards or would like to make it easier to compile your final program with CYGWIN then the Template Method is your choice.
- Navigate to 'C:\Program Files\The Game Creators\AGK\IDE\Templates'
- If using VC++ 2010 copy the Folder 'template_vs10', If using VC++ 2008 copy the Folder 'template_vs9'.
- Paste it in the same directory (or into, '\AGK\IDE\apps\', directory) and Rename the folder to the name of your project.
- Navigate into your new folder, open 'Template.sln'
- You can now begin editing the file 'template.cpp' to make your program.
PART 4a: Android Compiling (used AppGameKit Wizard)
- Copy your 'main.cpp' file (and any additional header files you may have added).
- Navigate to your 'C:\android\AGK\IDE\templates\template_android\jni\' folder. (NOTE: This is in the 'C:\android\' folder you created earlier.)
- Paste your 'main.cpp' file here.
- Delete the file 'template.cpp', rename your main.cpp file 'template.cpp'.
- Open 'template.cpp' and change the line '#include "main.h"' to '#include "template.h"'
- Open CYGWIN.
- Enter, cd /cygdrive/c/android/AGK/IDE/templates/template_android , Press Enter. (NOTE: CYGWIN is case sensitive, and does not like spaces in the path name.)
- Enter, /cygdrive/c/android/android-ndk-r8/ndk-build 2> log.txt , Press Enter.
- Unless there are any compilation errors, CYGWIN should make your 'libtemplate.so' file, If not
your 'C:\android\AGK\IDE\templates\template_android' folder will contain a file named log.txt which will show the errors.
- Open Eclipse.
- On the left side of the window in the Package Explorer area, Right Click -> Import.
- Expand the 'General' Selection and Select 'Existing Projects into Workspace'.
- Select 'Browse' and navigate to 'C:\android\AGK\IDE\templates\template_android', Click 'Finish'.
- Right Click your Project -> Android Tools -> Fix Project Properties.
- From the top menu choose Project -> Clean.
- At this point you can Test on your Android by right clicking your Project -> Run as -> Android Application.
- Any time you update your project you will need to re-compile with CYGWIN and then right click your project in Eclipse, choose 'Refresh' and then Project -> Clean.
- To make your project into an Android .APK file, Right click you project -> Export.
- Expand the android selection and choose 'Export Android Application'
- It will ask you which project to be exported, 'Template' should allready be selected, click 'Next'.
- You will be asked to provide a KeyStore, if you do not have one already you can create one.
- Choose a location and name for your KeyStore. I chose 'C:\android\key'.
- Enter a password and click 'Next'
- You will be asked for an Alias, Password, a Validty, and at least on piece of personal information. Click 'Next'.
- Choose a Destination for your .APK file and Click 'Finish'
- You now have a Finished Android Application.
PART 4b: Android Compiling (used Template Method)
- Copy your 'template.cpp' file (and any additional header files you may have added).
- Navigate to your 'C:\android\AGK\IDE\templates\template_android\jni\' folder. (NOTE: This is in the 'C:\android\' folder you created earlier.)
- Paste your 'template.cpp' file here and replace the one that is allready there.
- Open CYGWIN.
- Enter, cd /cygdrive/c/android/AGK/IDE/templates/template_android , Press Enter. (NOTE: CYGWIN is case sensitive, and does not like spaces in the path name.)
- Enter, /cygdrive/c/android/android-ndk-r8/ndk-build 2> log.txt , Press Enter.
- Unless there are any compilation errors, CYGWIN should make your 'libtemplate.so' file, If not your 'C:\android\AGK\IDE\templates\template_android' folder will contain a file named log.txt which will show the errors.
- Open Eclipse.
- On the left side of the window in the Package Explorer area, Right Click -> Import.
- Expand the 'General' Selection and Select 'Existing Projects into Workspace'.
- Select 'Browse' and navigate to 'C:\android\AGK\IDE\templates\template_android', Click 'Finish'.
- Right Click your Project -> Android Tools -> Fix Project Properties.
- From the top menu choose Project -> Clean.
- At this point you can Test on your Android by right clicking your Project -> Run as -> Android Application.
- Any time you update your project you will need to re-compile with CYGWIN and then right click your project in Eclipse, choose 'Refresh' and then Project -> Clean.
- To make your project into an Android .APK file, Right click you project -> Export.
- Expand the android selection and choose 'Export Android Application'
- It will ask you which project to be exported, 'Template' should allready be selected, click 'Next'.
- You will be asked to provide a KeyStore, if you do not have one already you can create one.
- Choose a location and name for your KeyStore. I chose 'C:\android\key'.
- Enter a password and click 'Next'
- You will be asked for an Alias, Password, a Validty, and at least on piece of personal information. Click 'Next'.
- Choose a Destination for your .APK file and Click 'Finish'
- You now have a Finished Android Application.