Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>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.</p> <p>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. </p> <p><strong>The key is updating Eclipse ADT Plugin preferences to use the absolute path of the Android SDK.</strong> 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).</p> <pre><code>echo com.android.ide.eclipse.adt.sdk=$sdk_path &gt;&gt; ./workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.android.ide.eclipse.adt.prefs </code></pre> <p><strong>Mac Instructions</strong></p> <p>Here's my unzipped directory structure:</p> <pre><code>android_dev_environment (root) - android-sdk-macosx - eclipse - initial_setup - workspace </code></pre> <p>And here are the contents of initial_setup:</p> <pre><code>#!/bin/bash # Set the Android SDK path in Eclipse. Must be the absolute; a relative path # does not work with the AVD Manager. cd "$(dirname "$0")" sdk_path=`pwd`/android-sdk-macosx echo "Setting Android SDK path in Eclipse..." echo com.android.ide.eclipse.adt.sdk=$sdk_path &gt;&gt; ./workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.android.ide.eclipse.adt.prefs echo "Android SDK path set." # Create a new AVD echo "Creating new AVD..." echo no | $sdk_path/tools/android create avd -n Android403 -t 1 --force echo "AVD created." </code></pre> <p><strong>Windows Instructions</strong></p> <p>Here's my unzipped directory structure:</p> <pre><code>android_dev_environment (root) - android-sdk-windows - eclipse - initial_setup.bat - java - workspace </code></pre> <p>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 <a href="http://wiki.eclipse.org/Eclipse.ini#Specifying_the_JVM" rel="noreferrer">above the -vmargs line</a>:</p> <pre><code>-vm ..\Java\jdk1.6.0_33\bin\javaw.exe </code></pre> <p>And here are the contents of initial_setup.bat:</p> <pre><code>REM Set the Android SDK path in Eclipse. Must be the absolute; a relative path REM does not work with the AVD Manager. cd &gt; temp.txt 2&gt;&amp;1 set /p sdk_path= &lt; temp.txt del temp.txt set sdk_path=%sdk_path%\android-sdk-windows set sdk_path=%sdk_path:\=\\% set sdk_path=%sdk_path::=\:% echo “Setting Android SDK path in Eclipse...” echo com.android.ide.eclipse.adt.sdk=%sdk_path%&gt;&gt; .\workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings\com.android.ide.eclipse.adt.prefs echo “Android SDK path set.” REM Create a new AVD echo “Creating a new AVD...” echo no | .\android-sdk-windows\tools\android create avd -n Android403 -t 1 --force echo “AVD created.” pause </code></pre> <p><strong>For 64 bit Windows</strong> 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..."</p> <pre><code>set java_exe=%~dp0\..\..\..\Java\jdk1.6.0_33\bin\java.exe set javaw_exe=%~dp0\..\..\..\Java\jdk1.6.0_33\bin\javaw.exe if defined javaw_exe goto :EOF </code></pre> <p><strong>How to Use the Environment Bundle</strong></p> <ol> <li>Unzip the bundle</li> <li>Double-click on initial_setup in the android_dev_environment folder to set the Android SDK path to the user’s absolute path and create the default AVD</li> <li>Run the Eclipse executable inside the eclipse directory</li> </ol> <p><strong>Note:</strong> 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.</p> <p>Hope this helps!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload