23 February 2011

How To: Setup Android Development on Windows


See the SDK page and requirements for more information but essentially you’ll need:

Then you’ll need:

  1. Install ADT Plugin in Eclipse.
  2. Use the ADT Plugin to add platforms and other components: Eclipse, Window, Android SDK:
    AndroidSDKManager
  3. Setup a new emulator (AVD: Android Virtual Device).
  4. Use your Android device for debug.

Follow the instructions about installing to set up the environment and I recommend doing the Hello World example to check everything works.

Problems and Fixes

Lots of help on the Android pages here, but my own notes:

  • Eclipse: No Java virtual machine was found
    On loading eclipse you might experience the error:
    ”A… Java Development Kit (JDK)… must be available in order to run Eclipse. No Java virtual machine was found…”
    Either:
    • You might have the wrong versions of Eclipse and the SDK e.g. a 64bit eclipse and a 32bit Java or visa versa. If you’re not sure you can
    • You might try specifying the –vm switch: Create a shortcut to eclipse then append the path to your JDK so you would end up with a target like:
      "E:\Program Files\Eclipse\eclipse.exe" -vm "C:\Program Files\Java\jdk1.6.0_29"
  • ADT Installation Error: "requires plug-in org.eclipse.wst.sse.ui"
  • Android Emulator fails to run under Eclipse
    When you try to run the emulator if it fails with:
    error: unknown virtual device name: '[emulator name]'
    Then it’s probably looking for the AVD files in the wrong place. in Windows the default is “C:\Users\[username]\.android” so you need to set an environment variable to wherever it is e.g. as of writing:
    1. Click start and type environment or Go to: Control Panel/System/Advanced System Settings/Advanced tab/Environment Variables button (at bottom)
    2. Click New and enter:
      ANDROID_SDK_HOME
      [path to folder] e.g. F:\Users\[username]\
    3. Restart Eclipse
  • Debugging won’t run: To enable debug of your app, in AndroidManifest.xml file add: android:debuggable="true"
    to the application element.
  • Samsung device USB driver missing: You need to install Samsung Kies and connect the phone without debugging that should install the necessary driver. Once installed I found you need to stop Kies, disconnect the device, re-enable Debugging and reconnect the device. [phew]. Then check it’s connected by running:
    C:\android-sdks\platform-tools>adb devices
    Which should give output like:
    List of devices attached
    214D11244FF7ACB6F        device

No comments:

Post a Comment