I'm the iOS/Xcode guy at the office and am typically not involved with android projects. Now that we're developing with Gideros, I'm android involved. I decided to write up this doc to hopefully steer other android newbies clear of the snags I ran into during the setup of the SDK and the import/build process of a Gideros project.
I admit, this appears to be a bit overwhelming, but only because it's a step by step procedure. After completing this, you'll likely not have to revert to it again. It's actually quite simple to make a Gideros project for android, I just chose to not leave anything to chance. Please forgive me for any typos, I don't typical do this writing stuff.
Note: Steps 3 & 4 must always be completed for a Gideros to android project.
At the time this was written, versions are as follows:
Mac OSX 10.9
Gideros version: 2013.09.1
Android ADT Bundle version: 2013.10.30 (included SDK 4.4, used target=android-19)
# Step 1: Download and directory setup for android SDK
a. Download the latest SDK ADT Bundle for Mac here: developer.android.com/SDK/index.html#download
b. Once downloaded, unzip the bundle. The contents should include two folders: ‘eclipse’ and ‘SDK’.
c. Place the ‘eclipse’ folder into ‘Applications’.
d. Create a working folder for android development somewhere in your user directory. For example: Mac HD > Users > User Name > android.
e. Place the ‘SDK’ folder from the downloaded bundle inside the android folder.
f. Create a folder named ‘workspace’ inside the android folder.
On completion: You should have the eclipse app folder in Applications and a working android directory your User directory that contains two folders: ‘SDK’ and ‘workspace’.
# Step 2: Eclipse Setup
This step assumes you have never executed eclipse.
Note about android and eclipse: You may experience things like redundant error messages, error messages when there isn’t an error or perhaps no error messages when there actually is an error. If you encounter problems, like Xcode, the solution is usually extremely simple yet never obvious. Google it!
a. Launch Applications > eclipse > eclipse.app
b. A popup menu should display asking to define a workspace. Select the user > android > workspace folder we created. Select ‘Use this as the default and do not ask again’ option if you want.
c. Another popup menu should display asking to configure the SDK. An error dialog might also popup stating the location of the SDK hasn’t been setup. Close the error dialog.
On the configure SDK menu, select ‘Use existing SDK’ and browse to the android > SDK folder we created. Then continue through the popup until it closes.
Note: If the configure SDK popup isn’t responding to actions, then the error dialog is probably open and behind the menu. Move the menu so you can close the dialog.
On completion: You should be able to close and re-open eclipse.app without errors.
# Step 3: Gideros project export and Eclipse project import
a. In Gideros select File > Export Project. Select android and export project to a temporary location such as Desktop.
b. Open Eclipse and select File > Import.
c. Select General > Existing Projects into Workspace and click Next.
d. Set ‘Select root directory’ to the exported Gideros project folder. Make sure the project is selected in the 'Projects' pane and then Select ‘Copy projects into workspace’. Click Finish.
Note: The imported Gideros project is now living in the 'workspace' folder we created earlier. You can delete the temporary exported project as it is no longer used.
On completion: You should have an imported Gideros project residing in the eclipse Package Explorer.
# Step 4: Build project in eclipse
a. Goto your SDK folder in the android working directory we created. Then goto folder > build-tools. In here should be at least one folder named something like 'android-4.4' or possibly '18.0.1'. If no folders in here, then either repeat the steps above or disregard these instructions and google 'how to install android SDK for eclipse'. Keep this folder open, we'll need it in a bit.
b. In eclipse, right click project folder in the Package Explorer pane and select properties. Goto Java Complier and select 'Enable project specific settings' if not already so. Set compliance level to 1.6 and 'Use default compliance settings'. Apply and Ok.
c. In Package Explorer, open project > project.properties. The last line should be something as such:
target=android-18
The target number is based upon what build tools we have in the SDK > build-tools folder we opened earlier. Use the key below to set edit the target.
android-4.3 = target=android-18
android-4.4 = target=android-19
android-4.5 = ?? No 4.5 at the time this was written. Probably will be target=android-20 if I had to guess.
or
17.0.0 = target=android-17
18.0.1 = target=android-18
18.1.0 = target=android-18
18.x.x = target=android-18
19.x.x = target=android-19
You get the picture…
Once you've figured out the required target, edit the line of code and save the file.
At the time this was written:
Gideros version: 2013.09.1
Android ADT Bundle version: 2013.10.30 (included SDK 4.4, used target=android-19)
d. In eclipse, goto project in toolbar and select 'clean'. Select 'Start a build immediately' if not already so and then 'OK'.
e. A build progress dialog should pop-up, complete and then close. If no errors in console, then build was successful!
Note: If a build progress dialog doesn't show and the project > 'gen' directory is empty, this means no build tools. Repeat step 4.
On completion: You should be able to successfully build a Gideros project.
# Next Step:
Now, you may have some warnings after build completion. Might be a good idea to address those, or not, but ultimately up to you.
From here, you'll probably want to export to .apk and test on a device. After that, you would do stuff like define app label name, icons, and launch images (which all can be done in eclipse).
Everything I just mentioned is throughly documented here: developer.android.com/tools/workflow/index.html
Have fun!
Comments
if you want, we can guess blog it on Gideros blog with links and references to your company/project, etc
Yea, that would great!
You can download the .bat file here:
One-click Android deployment for Gideros
In a way this is why i like gideros, it is giving yo the project files directly rather then the compiled installation file (apk or ipa) like lots of other frameworks are doing.
My point is with eclipse yo are in much more control, it is not only an editor it is an fully functional and complicated IDE
The only things I need with my projects are
- building a signed release apk
- removing not needed permissions, if necessary
- changing the native's keyboard orientation from portrait to landscape (which Gideros can't do by itself yet)
That's no problem using the one-click method, so luckily I don't have to touch Eclipse :-)