|
Documentation
How to check out In-the-box, build it and run your code
1 - Prerequisites
2 - Checking out the projectTo check out In-The-Box in Xcode 4, go to Window > Organizer. Go to the Repositories tab, click on the "+" at the bottom-left corner and select "Add Repository".
Under "Location", enter "https://in-the-box.googlecode.com/svn/", or replace "https" by "http" for a read-only checkout. "Subversion" should be automatically selected as type. Enter a name to identify the repository and click "Next".
As Trunk, Branches and Tags, enter the following and click "Add" :
If you want an access that allows you to commit (with "https"), select your newly added repository, enter your username and your generated googlecode.com password.
FInally, select "Trunk" and click "Checkout". Choose where you want to put the checked out project. 3 - Building and running In-The-BoxOpen the checked out project in the Finder and double-click to open "InTheBox.xcodeproj". Select an "InTheBoxSim" target and click run. If you want to run it on a device, make sure you have valid provisioning profiles installed (for more info, check the iOS provisioning portal).
4 - Running your own java codeIf you want to run your own java code, you need to write one or more java classes, and one must have a main method. These classes must be compiled as ".class" files using javac. Then to feed it to Dalvik, you must convert it to Dex files. To do this, use "dx", inside the "Platform Tools" of the Android SDK. Usage example : android-sdk-mac_x86/platform-tools/dx --dex --output=hello.jar Hello.class (This will put the dex files inside a jar archive). The resulting jar must be added to the Xcode project. To do so, right-click on a folder inside your project and select "Add Files to 'In-the-box'" (for example you can add it inside "InTheBoxSim/test"). We also want it to be copied inside the Application Bundle. To do so, click on the root element of your project, select the target "InTheBoxSim" and go to the tab named "Build Phases". Expand the "Copy Bundle Resources" section and add your jar (either by drag & dropping or by clicking "+").
Next you need to modify In-The-Box's main file so that it uses your dex files. "main.m" can be found in "Supporting Files". In this file you have to modify the classpath of the jar containing your dex files and the name of the class containing your main method. This can be done easily by modifying the constants "MAIN_JAVA_CLASS_NAME" and "JAR_NAME". The jar will be searched inside the Application Bundle, where it should be copied if you followed the previous step.
|