Sunday, August 14, 2011

Problems with Eclipse and Android SDK

A lot of people are having issues with the latest android sdk and eclipse IDE. Fortunately these can be fixed.
I will list the problems and solution in the order of their occurrence. Please keep in mind that this post only deals with Android SDK in Windows platform.

1. The Android SDK installer fails to detect Java SDK.
Problem: When you try to install the android sdk using the installer, you might have seen this weird error. Even though you have the latest Java SDK installed in your system, the installer will complain that it did not find any Java SDK in your system.
Solution: The solution is pretty simple. When you see this error message, click the 'Back' button and then press "next' button again. Bingo! problem solved. I have reported this issue to google, but they never fixed it. weird!

2. Eclipse does not display any android SDK platforms.
Problem: When you try to create a new android project in eclipse, you cannot select any target platform and the selection list is greyed out/frozen.
Solution: First make sure you have installed the required SDK packages using android SDK manager. Then goto eclipse. Choose Window-> Preferences. Select 'Android' from the left tree. You will see 'SDK Path/Location' field to the top of your screen. Click browse and select the path where you have installed the android SDK. Usually this will be <Windows Drive>/Program Files/Android/android-sdk. Click Apply. Now you will be able to select target platform.

3. Launching the emulator from eclipse always fails with an 'Invalid command-line parameter' error.
Problem: When you try to launch the emeulator from eclipse, a 'Invalid command-line parameter' error is reported and emulator never launches.
Solution: The problem is becuase the SDK path contains white space. You can fix it in two ways.
First, install the sdk to a apth where there is no spaces.eg: C:\android-sdk
Second, and the best solution is to edit your SDK path manually. See Problem #2 is see how to change SDK path. If you haven't already set your SDK path, do it first. Then edit the path manually. If you are using Windows 32 bit, Change 'Program Files' in the path string to 'PROGRA~1'. If you are using Windows 64 bit, change it to 'PROGRA~2'. Do not change the rest of the string. For eg:. If your original path was 'C:\Program Files\Android\android-sdk', you change it to C:\PROGRA~1\Android\android-sdk.
Click Apply, and you are ready to go.

4. Emulator stuck at 'android' logo screen
Problem: When you try to launch the emulator, it gets stuck at android logo.
Solution: Try to reduce the SD card memory size. Also make sure your system has enough RAM. When you set  up a new emulator or make changes to its properties, it usually takes several minutes for the emulator to launch for the first time. So wait...


5. The Emulator has wrong orientation
Problem: Sometimes (especially when your target is 3.0), you emulator might show up in the wrong orientation.
Solution: Press Ctrl+F11 or Ctrl+F12 to change the orientation.

No comments:

Post a Comment