48

Recently I upgraded Eclipse along with ADT plugins to Android L priew.

I have the latest Java update as well i.e. Java 8.

I was unable to see the layout and it displays as below

enter image description here

MrEngineer13
  • 38,642
  • 13
  • 74
  • 93
Kartheek Sarabu
  • 3,886
  • 8
  • 33
  • 66

10 Answers10

121

Please, note this Android icon in the upper side of the screen

Android icon

This icon is in the upper side of this screen:

Screen which displays the API version to render the code

Probably it's displaying the number 20. This is the selection to use the API 20 to render the window. Change it to 19, or 20W (not 20L). It'll fix the problem.

API 19 selected

Community
  • 1
  • 1
Alexandre Landim
  • 1,453
  • 1
  • 10
  • 10
  • That did it for me. Can you explain why cant Android L be loaded even though I have the latest sdk installed? – Rahul Dabas Jul 04 '14 at 19:43
  • 2
    Have you selected Java 7 to compile your project? Java 7 or higher is required if you are targeting the L Developer Preview, and also Eclipse Indigo (Version 3.7.2) or higher. Some versions of ADT are designed for use with SDK Tools r23.0.2. If you haven't already installed SDK Tools r23.0.2 into your SDK, use the Android SDK Manager to do so. – Alexandre Landim Jul 11 '14 at 21:24
  • I couldn't find that icon in the Mac, so I just uninstalled the Android L and Android 4.4W packages in the SDK Manager. – Avi Cohen Jul 20 '14 at 06:33
  • Boom! I love a simple solution. – SBerg413 Aug 19 '14 at 18:48
  • In eclipse under Mac OS there isn't interface, no buttons, no selections... Perhaps some very well hidden submenu :) ? – Lucabro Aug 21 '14 at 09:38
  • 1
    Mac OSX: If you don't see the toolbar that lets you select the Android version for rendering then you are likely running Java 6. Upgrade to JDK 7 or later. – Volker Voecking Oct 20 '14 at 09:15
  • please everyone have in mind that this method is NOT a solution and the problem will persist on every new Android release as all of them require newer Java versions. Check my answer for instructions on how to solve the issue. – Antilope Dec 15 '14 at 15:46
8

You may also need to modify eclipse config to run on Java 7 Runtime.

Add this to the beginning of eclipse.ini

-vm
C:/Program Files/Java/jre7/bin
josephus
  • 8,284
  • 1
  • 37
  • 57
  • Thanks.It worked for me. I tried all other solutions, but after adding this it worked. I tried with jre1.8 – Prashant Feb 23 '15 at 08:09
8

For anyone having the same issue: You dont need to unistall Java 6. All you need to do is to set it correctly on Eclipse.

  1. First have the JDK fot Java 8 (a.k.a Java 1.8) from: http://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. Install it normally.
  3. Go to the Eclipse Preferences and to Java -> Installed JREs
  4. "Add..." -> Standard VM -> Next and search for the install path (on Mac it will be something like: /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home).
  5. Enter a nice name like "Java JDK 1.8" and Finish
  6. Make sure to mark the new JRE as shown on the imageenter image description here
  7. Restart Eclipse for the changes to take effect.
Antilope
  • 340
  • 2
  • 10
4

This seems to be the issue....the 'Automatically Pick Best', picks the 'L' version of API 20 instead of the 4.x version of API 20. In my instance, I am targeting API 19 and apparently that's not compatible with the choice of "API 20: Android L (Preview)".

Sorry, this system won't let me post images yet...

  • If i select `API 19 | 20` it works But If i choose `API 20 L` it displays error like `Parsing Data for android-L failed Unsupported major.minor version 51.0` – Kartheek Sarabu Jul 01 '14 at 04:44
3

You can see the following note in https://developer.android.com/preview/setup-sdk.html

Note: The Eclipse ADT plug-in requires Java 7 if your compilation target is the L developer preview.

Maybe you don't have Java 7 installed?

noloman
  • 11,411
  • 20
  • 82
  • 129
  • @Kartheeks were you able to fix the issue? Any solution which worked for you? – Sufian Nov 05 '14 at 07:51
  • The problem for that is having different jre versions I have java 6 and 8 both installed in my system, so I uninstalled java 6 and set path for only java 8. But remember to restart the system after setting the paths. Now error is gone while viewing android L Preview – Kartheek Sarabu Nov 05 '14 at 08:27
  • @Kartheeks it's quite a mess. Eclipse uses Java 6 by default and on OSX (not sure about other OSes) it can't run with Java 7 or 8 (gives error as described [here](http://burrsutter.blogspot.com/2013/12/eclipse-does-not-contain.html)). I installed Eclipse Mars and it works just fine now. Strangely though, on my personal MacBook it was ok with Luna but not on my office's Mac Mini. – Sufian Nov 06 '14 at 06:44
  • @Sufian I am not aware of Mac OS but in windows both java 6 and java 7 can be installed manually. If you check in `Add or remove programs` in windows you can find them – Kartheek Sarabu Nov 07 '14 at 04:49
2

The problem for that is having different jre versions

I have java 6 and 8 both installed in my system, so I uninstalled java 6 and set path for only java 8.

But remember to restart the system after setting the paths.

Now error is gone while viewing android L Preview

Kartheek Sarabu
  • 3,886
  • 8
  • 33
  • 66
2

Check your JDK version. It must be JDK1.7. JDK 1.6 does not work.

Ligen Yao
  • 641
  • 1
  • 6
  • 6
1

OPen SDK Manager --> Uninstall Android L (API 20,L preview),,use this if you want to resolve this error Quickly

0

What I did after updating java was to set the variable system for java again

Advanced System Settings -> Advanced -> Environment variables.

I updated JAVA_HOME with this directory

C:\Program Files\Java\jdk1.7.0_60

Back in eclipse, you can either:

Click Properties -> Android -> Project Build Target

Change android L for android 4.4

If you want to use android L, then change in the manifest minSdkVersion to "L"

Sgdva
  • 2,800
  • 3
  • 17
  • 28
0

In my case , my current java version is 1.6.

So i run the command 'update-alternatives --config java' to change the version to java 1.7, then restart the Eclipse, the problem is fixed.

Note: I installed muti-java version(Java 1.6 and java 1.7)

Hope help to you.

Hai-Yang Li
  • 376
  • 2
  • 4