Appendix A - Setup the build environment on an offline system.
I mentioned in the "Setup the build environment" section that the internet connection was not absolutely mandatory.
This guide explains how to fetch everything from a simple browser, and how to deploy them on an offline computer, even without administrative rights. It more or less replaces the part where we use the "SDK Manager" and the part where we perform the "Import project" in eclipse.
First things first, download everything referenced in the "Setup the build environment" as the inventory.
Next, depending on your choice of my Github or your own Github fork, download the sources as a zip file:
Log on Github
, and go to my (or your) andors-trail repository page. Then, select the branch you want (by default, keep "master"), and finally, look at the bottom right of the page for a "Download Zip" button. Click it, and save the zip file.
Trouble is, that was the easy part.
The hard part is "hacking" the "SDK Manager" to get the files it needs through a browser. It involves using your brain a little, but I'll give step by step instructions.
On your offline computer, launch the "SDK Manager.exe" in your ADT root. It should begin by trying (and failing) to retrieve the latest list of packages available. Once failed, it will give you the URLs it tried to contact. There should be one called "repository-8.xml", but I guess this name will change someday, so try to identify it on your own.
Copy the whole URL associated with it. For me, it currently is https://dl-ssl.google.com/android/repository/repository-8.xml
Note also the other URL, talking about addons (mine is "addons_list-2.xml" located at https://dl-ssl.google.com/android/repository/addons_list-2.xml
). It will be useful if you plan to use the emulator.
On your internet facing computer, direct your browser to this address. You should be presented with something raw, not as pretty as a webpage : a XML file. Your browser should still present it rather nicely, with options to fold the tags.
What we are looking for is exactly what we download in the connected guide, and some more:
- The latest "SDK Platform"
- The latest "Intel x86 Atom System Image", if you plan to use the emulator.
- On Windows and Mac OS X computer with Intel processors with virtualization extensions (Intel VT-x), the latest "Intel x86 Emulator Accelerator (HAXM)", if you plan to use the emulator.
- And optionaly, as you may be away from Google on your offline machine: the latest "Documentation for Android SDK"
The approach is the same for all of these, except the "Intel x86 Atom System Image" & "Intel x86 Emulator Accelerator (HAXM)", which are hosted in addons repository.
So, in the XML file we opened earlier, look for the following:
And two lines below, you should find:
This means that this section describes the Android API 2.
We are looking for the latest, which to this day is API 19 (matching Android 4.4 KitKat). It should be in the last occurrence of <sdk:platform>. Once you found it, look a few lines below for this section:
Code: Select all
<sdk:archive arch="any" os="any">
The interesting part here is:
Code: Select all
To get this file, we just need to replace the XML filename in the URL by this file, so https://dl-ssl.google.com/android/repository/repository-8.xml
Point your browser to this new URL to download this zip file.
Do the same to find the documentation, except the highest level tag is now "<sdk:doc>" instead of "<sdk:platform>". There should be only one: the latest.
Now, let's try to find where Intel hides its stuff. Point your browser at the URL for the addons given by your "SDK Manager".
Mine is https://dl-ssl.google.com/android/repository/addons_list-2.xml
On it, I found this section:
Code: Select all
and that one:
Code: Select all
<sdk:name>Android x86 System Images</sdk:name>
See how the descriptions under the "<sdk:name>" tags closely match the ones of the desired items ? So we'll need to visit the two URLs referenced under the "<sdk:url>" tags.
, we can find this section:
Code: Select all
So, depending on your platform, download the zip file from https://dl-ssl.google.com/android/repository/extras/intel/haxm-windows_r03.zip
. Did you notice that we are using the URL of the last XML file visited as a base for these two?
Apply the same logic on the second URL (https://dl-ssl.google.com/android/repository/sys-img/x86/sys-img.xml
) to get the latest "Intel x86 Atom System Image". As a gift to you, here it is today: https://dl-ssl.google.com/android/repository/sys-img/x86/sysimg_x86-19_r01.zip
You now have everything you needed from your online computer, so copy to a flash drive, DVD, or whatever your favorite media transfer system is, and we'll attack the part where we setup your offline computer.Remember: now, everything happens on your target development computer !
All the zip files downloaded from the "SDK Manager" URLs must be unzipped directly in the "<ADT Root>/sdk/" folder.
For example, copy the zip files in "<ADT Root>/sdk/", right click on them (one by one), and select "Winzip->Extract to Here".
Run the "<ADT Root>/SDK Manager.exe" tool to check that everything is installed according to what was described in the "online" mode guide.
Unzip the zip downloaded from Github or Google code in your workspace. Now, launch "<ADT Root>/eclipse/eclipse.exe".
In the package explorer, right-click, select "Import..." and select "Existing Android Code Into Workspace" under the "Android" folder. Use the "Browse..." button to select the folder created in your workspace by unzipping the source package.
Tick the "AndorsTrail" project in the "Projects to import" table, and click "Finish".
Now, to be able to view the Android documentation directly in eclipse, use the package explorer to locate "android.jar". It currently is under "AndorsTrail" (the project's root folder), then "Android 4.3" (subject to change).
Right click on "android.jar", and select "Build path->Configure build path...".
In the opened "Properties for AndorsTrail" window, locate again your "android.jar" file, normally under "Android 4.3" in the "Libraries" tab.
Expand the "android.jar" node, and select the line "Javadoc location". Click "Edit...", then "Browse...".
Select "<ADT Root>/sdk/docs/reference/" and click "Ok" three times (not three clicks on the same "Ok", just click "Ok" until you just have the main eclipse window opened).
Now, you can hover your mouse cursor over the android class and methods name to see their description/documentation.
Note that the AndorsTrail code is NOT documented this way (not documented at all actually), so only the classes and methods that are part of the Android SDK will show you such help.
Voila! That's all folks!
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2