Contributing to Andor's Trail - Contribution Guide

Discussions of the development process of the game.
Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Edit the code !

Post by Zukero » Sun Jan 26, 2014 11:10 pm

Edit the code !

In this section, I will not teach you Java, but give you tips that will make your journey in the Andor's Trail code a bit easier.

Make AT run with test data
I said earlier that starting the game in an emulator takes ages to load. However, the dev team has included a test mode in AT, that loads a single minimal map, with very little data. Whether you want to test a map, a quest, or any piece of code, you should start with this setup first.
To activate this mode, open the AndorsTrailApplication class under src/com.gpl.rpg.AndorsTrail, find the line:

Code: Select all

public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
and change it to:

Code: Select all

public static final boolean DEVELOPMENT_DEBUGRESOURCES = true;
There are five other booleans under this one, and you can experiment with them, as they activate various debugging features.

There's red everywhere and I cannot start the game.
Sometimes, eclipse has issues loading the android SDK correctly. This is characterized by the following message:

Code: Select all

The project was not built since its build path is incomplete. Cannot find the class file for android.content.Context. Fix the build path then try building this project
I think it's one of the reasons Google started creating android studio...
To solve this, I close and restart eclipse... sometimes twice or more.
You can also try using the menu "Project", then "Clean..." to clean up your project before restarting eclipse...

Upgrade to the latest version
If you used my repository, or the one on google code, do a right-click on the project's root folder -> "Team" -> "Fetch from upstream".
If you created your own fork on GitHub, you need to configure my repository as your "upstream" remote site (while yours is "origin"), and use the "Team"->"Fetch from..." menu to fetch from "upstream" and not "origin".

Submit a patch for inclusion in the game
Once happy with what you created, you may want to offer it for inclusion in the official game.
The workflow is the following:
  • Commit your work in Git. Make sure to know which branch your are working in.
  • Push your commits to your github fork (Eclipse calls that push to upstream, while it's actually a push to origin/<branch_name> in Git terms).
  • Log on github, select your branch, and open a pull-request.
  • Any new commits you push to this branch will automatically update the pull-request, so if you implement a change after my comments (or others), you don't need to close your pull-request and open a new one.

The rest is up to you...
This section will be augmented with the answers to the frequent questions that show up.
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

Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Content Integration

Post by Zukero » Sun Jan 26, 2014 11:10 pm

Content Integration

This section covers the activity that makes your content actually playable.
It requires you to have set up your own build environment, as explained in the "Development" section, "Set up the build environment" sub-section.
If this seems like too much, or too difficult for you, don't worry. We'll consider raw and untested content anyway. But I know that being able to test your own content on your own phone before anyone else sees it can be very satisfactory.

As my first "pupil" (I hope you don't mind me calling you a pupil) said after he finished setting up his own environment:
Moerit wrote:What a fun running over my own map :)
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

Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Project layout presentation

Post by Zukero » Sun Jan 26, 2014 11:10 pm

Project layout presentation

Once your environment is set up, you should see the following folders in your Andor's Trail project.
  • src
  • gen
  • assets
  • bin
  • libs
  • res
gen and bin are folders used by the android SDK. The files within are generated, and should not be edited. You can have a look if you wish, but I have not opened them after having a first look. However, under bin, after you first started the game, you should find an AndorsTrail.apk. This is the android installer for the version you last launched. If you want to make your friends & family playtest your own version, this is the file to send them.

assets is reserved for translation contents. The source repository only contains the source version of the translations: .po files and a .sh script to generate the equivalent .mo files. If you want to know more about this format, Google for "GNU GetText". What is used by the game is the .mo files. If you want to know more, read the section about integrating & testing your translations.

libs is there to hold the libraries used by Andor's Trail. You shouldn't need to look at this one either.

So, we're left with the two best folders in the world: src and res.

src means SouRCe, and that's where the source code of Andor's Trail is. Refer to the "Development" section for some info on it.

res means RESources, and that's where all the game data is. Sprites, maps, dialogues, NPCs.... everything's in there.
This is the folder that you will need to touch for content integration. Let's take a walk in it, before giving you step by step instructions for all the different content types.

So, under res, you'll find the following sub-folders:
  • anim
  • drawable
  • drawable-*
  • layout
  • layout-land
  • menu
  • raw
  • values
  • values-*
  • xml
anim, layout, layout-land, and menu contain XML files describing the UI of the game. layout-land contains the variations to apply when using the game in landscape mode (default is portait). All those XML files follow a format defined by the android SDK, and define how the game element will be presented. For example, this is where the layout of your character's quest log is defined. Not related to content creation. This is more for the developers. I have not touched them myself, so I will not go into details.

drawable, and the drawable-* variants contain the spritesheets. All the icons, all the NPCs, all the map tiles can be found here. For your information, the drawable folder is the default one. If your device declares a high, medium or low density of pixel (hdpi, mdpi, and ldpi respectively), they will look for graphics first in the correct folder, then if nothing is found, fallback to the "drawable" one. So, if you make different versions with different resolutions of your graphics, place them in the three folders, while if you only make one, place it in the drawable folder. You can also have a default one in the "drawable" folder, and a high quality one in the "drawable-hdpi" folder only. It's always a good idea to put a fallback in the "drawable" folder, as who knows how bad device manufacturers can mess up.

The raw folder contains the game objects definition. The infamous JSON files that you create with the content editor are there.

The values folder contains oh-so-many useful things that I won't describe them all. However, in the following step-by-step instructions, you will see that I often refer to them. I can still tell you that all the strings (the text) shown in-game are defined here, that the game credits are there (the authors.xml file), and that the worldmap's HTML frame is there too (worldmap-template.xml).

The other values-* folders contain the translated versions of the strings existing in the normal values folder. Just like the drawable variants, if your device declares a local language of "fr", it will first look for a string in the values-fr folder, and if not found, fall back to the values folder. I believe these are outdated, and are gradually replaced by the .po files under "assets/" (citation needed :D).

Finally, the xml folder contains the maps, as .tmx files, as well as a worldmap.xml file that is used to define where each map is placed on the worldmap. To avoid confusing, this only covers the quick map you can view, not where you will land when quitting a map in-game: this is purely visual, and has no meaning in-game.

Don't hesitate to open all these files, and see how they are made. If you mess something up, Git will help you restore a correct state in no time.

So, by now, you should be rather comfortable with navigating the resource folder, so let's finally integrate your data!
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

Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Generalities

Post by Zukero » Sun Jan 26, 2014 11:10 pm

Generalities

When working on a new feature or content, create a new branch based on my latest "master" branch, and work on that branch until completely satisfied. This allows you to have several projects in parallel, and helps a lot if your first proposal is refused, while your second one is accepted. Don't worry, Git's branching system is powerful enough to make it easy to rebase an already started work on a new one (you started working, someone else published a change accepted by the team, so now you have to update the project while keeping your changes).

After producing your content, copy it in the right folder: JSON files in "res/raw/", TMX maps in "res/xml/", and sprites/spritesheets in "res/drawable" and/or its variants "res/drawable-*".

Once one of your files is copied in the right folder, you need to notify Eclipse that new files are available. To do so, select your folder in the package explorer (or any parent folder, or the project itself), and hit F5. You also need to refresh (with F5) every time you modify a file with an external tool, like Tiled. Once you can see your file in the package explorer, you need to let Git handle it. To do so, right-click on your file, select "Team", then "Add to index".

Once you reached a good state, commit your work in Git. To do so, right-click on the project name, select "Team", then "Commit". You will be asked to enter a comment for your commit. Please, enter a meaningful and precise description of what you changed. Then, review the files to integrate to that commit. Some files you haven't edited can be included, like ".project" or others. Remove them from the commit by deselecting them (untick their checkbox).

Once you cleared your content from any bugs (make sure to test them thoroughly), commit your changes to git, push your branch to your github repository (you need your own fork), and then make a pull-request from github.com.
This will automatically notify me, and the people following the development activities, of your submission, and if deemed worth, can be integrated in the official repository using only one click!
Last edited by Zukero on Fri Jun 06, 2014 2:51 pm, edited 1 time in total.
Reason: Changed references to Oskar's Github repo by references to mine.
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

Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Testing and integrating a new map

Post by Zukero » Sun Jan 26, 2014 11:10 pm

Testing and integrating a new map

So, at this point, you should have completed your map in Tiled, copied your .tmx file in the "res/xml/" folder of the project, and added it to the git index. If you think you missed a step, scroll back, as all the info you need to do so is in this guide.

Tip: don't forget to refresh your eclipse project after modifying a map with Tiled (select "res/xml/" folder in the package explorer, and hit F5).

To easily debug your map, I suggest you to first run it with the debug data set. To do so, edit the "res/xml/debugmap.tmx" file in Tiled, and create or modify a "mapchange" area to make it point to your new map. Then, open the "res/values/loadresources_debug.xml" file. Look for the following section:

Code: Select all

<array name="loadresource_maps_debug">
	<item>@xml/debugmap</item>
</array>
Add your map to the list :

Code: Select all

<array name="loadresource_maps_debug">
	<item>@xml/debugmap</item>
	<item>@xml/my_new_map</item>
</array>
If your map is named "my_new_map.tmx", you will use "@xml/my_new_map" without the trailing ".tmx".

Now, edit the "src/com.gpl.rpg.AndorsTrail/AndorsTrailApplication" class, and replace:

Code: Select all

public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
by:

Code: Select all

public static final boolean DEVELOPMENT_DEBUGRESOURCES = true;
You can now start the game from eclipse, move your character to the "mapchange" area you added/modified on debugmap.tmx, and finally walk on your own map!
If you have several maps, the procedure is the same. Simply add more lines to "res/values/loadresources_debug.xml".

This is the best time to walk on every tile, inspect every pixel, try every area (mapchanges, keys, replace...), and hunt every bug. If you find one, re-edit your file with Tiled, refresh the "xml" folder, and relaunch.

Once you are satisfied with this, it's finally time to integrate it in the real game.

Edit your connection point(s) on the existing map(s) (the map(s) which lead to yours), to add the required "mapchange" areas, and finally, edit the "res/values/loadresources.xml". Find this line:

Code: Select all

<array name="loadresource_maps_debug">
then find the next occurrence of :

Code: Select all

</array>
and add your maps above it, just like you did in "res/values/loadresources_debug.xml".

Revert the changes to "res/values/loadresources_debug.xml" and "src/com.gpl.rpg.AndorsTrail/AndorsTrailApplication" (back to the original state), either by manually editing, or by using Git's features.

You can now try your maps included in the real world of Andor's Trail, just like any players will, once (if) your content gets accepted.
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

Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Testing and integrating new game objects

Post by Zukero » Sun Jan 26, 2014 11:10 pm

Testing and integrating new game objects

So you've mastered the online content editor? How was your experience? Do not hesitate to give feedback about it! I find it pretty neat, especially the dialogue editor. It takes a bit of time to get it completely (requirements, conditionals...), but once you're used to it, you get pretty productive! Anyway, back on tracks, let's help you test your stuff.

By now, you should have created your JSON files, copied them in the "res/raw/" folder, and added them to Git's index. If you think you missed a step, scroll back, as all the info you need to do so is in this guide.

Now, you have to make the game engine aware of your new JSON files. Open the "res/values/loadresources_debug.xml" file. Find the array matching the object type for each of your JSON files. For example, if you created items :

Code: Select all

<array name="loadresource_items_debug">
	<item>@raw/itemlist_money</item>
	<item>@raw/itemlist_weapons</item>
	<item>@raw/itemlist_armour</item>
	<item>@raw/itemlist_debug</item>
</array>
Add your file to the list without the .json extension:

Code: Select all

<array name="loadresource_items_debug">
	<item>@raw/itemlist_money</item>
	<item>@raw/itemlist_weapons</item>
	<item>@raw/itemlist_armour</item>
	<item>@raw/itemlist_debug</item>
	<item>@raw/itemlist_my_awesome_new_items</item>
</array>
If you edited an existing resource, (for example, you created items, and you added them to an existing merchant's shop), I suggest that you don't include the modified existing JSON file to the arrays in "res/values/loadresources_debug.xml". Instead, attach them the same way to the objects already present in the debug resources. You may need to import the debug resources in the content editor, change them, and re-export them.
For simple changes, I often manually edit the JSON files, but be cautious when you do it. It's really easy to mess up with the brackets ("{" and "}"), braces ("[" and "]") and parenthesis ("(" and ")"), or to forget a comma. Indeed, I often edit them manually, but almost always have to correct them once or twice before it works...

Depending on which and how many types of objects you created, the approach will be different. Do you need an extra map? Will you replace a NPC's dialogues completely, or just add to it? Do you need a strong character to test your monster? Only you can answer it, as I can't cover all the different combinations here. I'll give you an example though. For my quest, I created some maps, which all had NPCs, involved some items... An existing NPC from Fallhaven was involved in that quest. I just made the Debug NPC use that Fallhaven guy's dialogues, and created a "mapchange" area on the debug map that lead to my first map.

Do not hesitate to completely break the debug resources, or change them completely. That's what they're made for ! And Git will handle restoring them once you're done. If you want to make a debug-compatible custom character with a high level, change a debug NPC dialogue to give you a reward of 1 000 000 000 XP points! It's not cheating, it's playtesting!

Now, edit the "src/com.gpl.rpg.AndorsTrail/AndorsTrailApplication" class, and replace:

Code: Select all

public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
by

Code: Select all

public static final boolean DEVELOPMENT_DEBUGRESOURCES = true;
You can now start the game from eclipse, and do what you have to do to test your data files!
Once you made sure that it all work as planned, integrate it to the real game:
- Do to "res/values/loadresources.xml" what you did to "res/values/loadresources_debug.xml"
- Undo what you did to "res/values/loadresources_debug.xml"
- Undo what you did to "src/com.gpl.rpg.AndorsTrail/AndorsTrailApplication"
Don't hesitate to use Git's features to perform the undos!

You can now try your objects included in the real world of Andor's Trail, just like any players will, once (if) your content gets accepted. Test it well, then commit, push, make a pull-request on github!
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

Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Integrate your new sprites/spritesheets in the game

Post by Zukero » Sun Jan 26, 2014 11:11 pm

Integrate your new sprites/spritesheets in the game.

At this point, you should have copied your PNG files in the drawable and/or drawable-* folders, and added them to Git's index.

Now, open the "src/com.gpl.rpg.AndorsTrail.resource/ResourceLoader.java" file, and look for the following:

Code: Select all

private static void prepareTilesets(DynamicTileLoader loader, int mTileSize) {
Below it are a bunch of "final Size..." lines, followed by an even bigger bunch of "loader.prepareTileset..." lines.

Duplicate the last one of these "loader.prepareTileset" lines, as many times as the PNG files you added. Now edit them following these instructions:

Code: Select all

loader.prepareTileset(R.resource.my_png_file_name_without_extension, "my_png_file_name_with_or_without_extension", new Size(<how many columns of sprites there are in my spritesheet>, <how many lines of sprites there are in my spritesheet>), defaultTileSize);
For efficiency, if you use the same numbers for your "new Size(X, Y)" part as one of the common ones (the one at the beginning, the "final Size..." ones I talked about earlier), replace it by the variable name. For example, you used:

Code: Select all

loader.prepareTileset(R.resource.my_png_file_name_without_extension, "my_png_file_name_with_or_without_extension", new Size(1, 1), defaultTileSize);
and at the beginning there is:

Code: Select all

final Size src_sz1x1 = new Size(1, 1);
you'd better change your line by:

Code: Select all

loader.prepareTileset(R.resource.my_png_file_name_without_extension, "my_png_file_name_with_or_without_extension", src_sz1x1, defaultTileSize);
Normally, that's all there is to do. But the game never shows your beautiful creations! For that, you (or someone else) have to create content that refer to it. See the other sections of this guide to know how (yeah! That's the only post long enough to need to advertize itself...)!

There's one exception : map tiles! If you created a spritesheet that is intended to be used to create maps, it would be very nice to do the following two things:
  • Make it 18 sprites wide, by at most 8 sprites high. Not mandatory, but it's the standard format.
  • Edit "res/xml/template.tmx" in Tiled (see the guide section on maps), and add your spritesheet in its library (seek help on Tiled, but digging through its menus should suffice. There's nothing terribly complicated).
Once all is done, you can commit to git, and push and open a pull-request on github!
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

Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Integrate your translation

Post by Zukero » Sun Jan 26, 2014 11:32 pm

Integrate your translation

At this step, you should have set up your build environment, and made some translations on weblate.

So, log on the Andor's Trail translation page on Weblate, select your language, and under the "Files" menu, click on the "Download source file" link.

For game content

Copy your downloaded .po file in the Andor's Trail eclipse project under "assets/", and rename it accordingly (for example, the downloaded andors-trail-game-content-fr.po becomes fr.po).

Now, you need to compile the .po in a .mo file. You have two options:
  • Download it directly on Weblate, by clicking "Download compiled translation" instead of "Download source file"(easier if you are using windows), and copy/rename it in the "assets/" folder.
  • Run the "createMO.sh" script in the "assets/" folder to compile all the .po files in corresponding .mo files.
If you want to run this script on windows, you will need a unix shell "emulator", like Cygwin or the awesome MobaXTerm.
It should run natively on Linux, MacOS X, and other unix-like platforms.

Just in case, make sure that the strings.xml file related to your language contains the "localize_resource_from_mo_filename" string, and that it points to the correct .mo file.

For user interface

Copy your downloaded .xml file in the Andor's Trail eclipse project under "res/values-XX" (depending on language code), and rename it accordingly (for example, the downloaded andors-trail-user-interface-fr.xml becomes res/values-fr/strings.xml).

Finally

Make sure to "refresh" the altered folders from the Eclipse project explorer, by clicking it, and pressing F5, so that eclipse is notified of changes you made on the filesystem outside of eclipse. You can now run the game from eclipse with your new translations included.

Make sure to exclude all the ".mo" files from your Git commits, as these are binary files not wanted in version control.
Last edited by Zukero on Mon Nov 09, 2015 2:53 pm, edited 2 times in total.
Reason: Migration to weblate.
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

Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Conclusion

Post by Zukero » Mon Jan 27, 2014 11:45 am

Conclusion

You have now reached the end of the Contribution's Guide to Andor's Trail. I hope this was a helpful, interesting, and overall fun time for you. If you have spotted any mistake, if some walkthrough seem incomplete, if you feel confused about something, or if you don't understand something, do not hesitate to comment on this topic. We will try to solve your problem, and eventually update the guide accordingly.

I guess this topic took the crown of the longest topic on andorstrail.com, as my counter shows a little over 51K characters... I hope it wasn't too much.

Now, it's your turn to work. Show your contributions!


It could use some screenshots. If any of you dear readers try to follow any of these instructions, would you be kind enough to take as much screenshots as you can, and send them to me?

Also, if you are aware of forum topics covering similar subjects, I'd like to link to them in the appropriate sections. Give me your selection below!
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

Zukero
Lead Developer
Posts: 1457
Joined: Thu Jul 21, 2011 9:56 am
android_version: 7.1

Appendix A - Setup the build environment on an offline syste

Post by Zukero » Thu Jan 30, 2014 1:32 pm

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/repos ... tory-8.xml
Note also the other URL, talking about addons (mine is "addons_list-2.xml" located at https://dl-ssl.google.com/android/repos ... 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:

Code: Select all

<sdk:platform>
And two lines below, you should find:

Code: Select all

<sdk:api-level>2</sdk:api-level>
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:archives>
  <sdk:archive arch="any" os="any">
    <sdk:size>59549530</sdk:size>
    <sdk:checksum type="sha1">fb87a779320bcb8a0a0932f6db8843ba72d1993b</sdk:checksum>
    <sdk:url>android-19_r02.zip</sdk:url>
  </sdk:archive>
</sdk:archives>
The interesting part here is:

Code: Select all

<sdk:url>android-19_r02.zip</sdk:url>
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/repos ... tory-8.xml becomes https://dl-ssl.google.com/android/repos ... 19_r02.zip.
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/repos ... list-2.xml.
On it, I found this section:

Code: Select all

<sdk:addon-site>
  <sdk:url>https://dl-ssl.google.com/android/repository/extras/intel/addon.xml</sdk:url>
  <sdk:name>Intel HAXM</sdk:name>
</sdk:addon-site>
and that one:

Code: Select all

<sdk:sys-img-site>
  <sdk:url>https://dl-ssl.google.com/android/repository/sys-img/x86/sys-img.xml</sdk:url>
  <sdk:name>Android x86 System Images</sdk:name>
</sdk:sys-img-site>
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.

On https://dl-ssl.google.com/android/repos ... /addon.xml, we can find this section:

Code: Select all

<sdk:archives>
  <sdk:archive os="windows">
    <sdk:size>1735049</sdk:size>
    <sdk:checksum type="sha1">7de70157ccaf9d8a3ba013a8fc83103c9c61ee34</sdk:checksum>
    <sdk:url>haxm-windows_r03.zip</sdk:url>
  </sdk:archive>
  <sdk:archive os="macosx">
    <sdk:size>250817</sdk:size>
    <sdk:checksum type="sha1">90d41666ced45bf492b99f84ce21118e6d4c3842</sdk:checksum>
    <sdk:url>haxm-macosx_r03.zip</sdk:url>
  </sdk:archive>
</sdk:archives>
So, depending on your platform, download the zip file from https://dl-ssl.google.com/android/repos ... ws_r03.zip or https://dl-ssl.google.com/android/repos ... sx_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/repos ... ys-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/repos ... 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!
Last edited by Zukero on Tue Sep 08, 2015 11:16 am, edited 2 times in total.
Reason: Removed Google Code.
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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest