I would like to have a portable android development environment that I could take everywhere (e.g. a usb stick). The idea is to have a folder that would include:
- eclipse
- android-sdk
- jdk
- .android (folder that contains the avd’s and keys)
- workspace
I installed Eclipse 3.7.0, added ADT plugin and
- added option “-vm ../jdk/bin/” in eclipse.ini file
- set the eclipse android-sdk variable to a relative path (../android-sdk)
- set the eclipse workspace to a relative path
- set the eclipse key folder to a relative path
The question is how can you make the avd’s portable? How can .android folder be portable? I saw some solutions mentioning the creation of an environment variable but I was thinking of a solution that works out of the box, or an ,as much as possible, automated procedure. The OS should be windows 7, but ideally should work on any version.
Any help would be greatly appreciated. Thanks.
I think I found a way to do this on a Mac and Windows. I have tested both solutions on multiple computers, but not exhaustively.
I had basically the same approach as you, but the problem is that the relative path for the Android SDK in Eclipse breaks the AVD Manager for some reason. It wouldn’t allow me to run existing or create new AVDs. I got around this by including an “initial_setup” script that is to be run one time to set the Android SDK based on where the user unzips this package. It also creates the initial AVD for them. So they download and unzip the package, run the initial_setup script, and are good to go with a default Android development environment.
The key is updating Eclipse ADT Plugin preferences to use the absolute path of the Android SDK. This is accomplished with this line from the script below. Note that the path for the preferences file is relative to the workspace (and the workspace path is set as relative to the Eclipse installation).
Mac Instructions
Here’s my unzipped directory structure:
And here are the contents of initial_setup:
Windows Instructions
Here’s my unzipped directory structure:
The Windows version has its own local JDK 6 in the java directory. Eclipse needs to know about it, so edit eclipse\eclipse.ini. Add the following lines above the -vmargs line:
And here are the contents of initial_setup.bat:
For 64 bit Windows you also need to tweak the find_java.bat file in the Android SDK so that it finds the Java installed with the bundle. Add the following lines to android-sdk-windows\tools\lib\find_java.bat (before it runs its own check that starts with the comment “rem Check we have a valid Java.exe…”
How to Use the Environment Bundle
Note: Running initial_setup on a Mac or a PC multiple times does not hurt anything. The dev environment will break if the user moves the whole directory after initial_setup, but running initial_setup from the new location will fix it. I plan on including a README file with these instructions.
Hope this helps!