4

I updated the Android SDK using SDK manager in Eclipse (Kepler). When I change the build target to Android 5.0 Lollipop, Eclipse doesn't build the projects anymore. After I clean the project, the "gen" folder becomes empty and R.java and other files are not generated again, although I have "Build Automatically" enabled. Running "Build Project" or "Build All" manually doesn't work either. I don't think it's caused by source code or resource file errors, because when I change the build target to any older Android version (20 and below), it starts building again.

The SDK update had pretty much everything, including the latest build tools (21.1.1), SDK tools (23.0.5), platform tools (21), and of course, Android 5.0 (API 21) itself. The computer I use runs Windows Vista Home Premium SP2(32 bit). I also tried to compile the same projects on my Mac, and no such problem there.

Can anyone see what is wrong?


Update 11/24/2014:

I turned on verbose logging of the build process in windows -> Preferences -> Android -> Build -> Build output - verbose. With "Build Automatically" enabled and Android build target at 5.0 (level 21), I only got two lines of output:

Removing generated java classes.
Starting full Package build.

However, when I change the build target to Android 4.4.2 (level 19), the output is very long.


Update 12/1/2014:

Thanks to @sagis, I'm able to build my Android projects targeted at Android 5.0 now. At first I tried to change the "Installed JREs" and "Compiler" preferences only, but it didn't work. So sagis was right, I had to uninstall the existing JREs (I actually uninstalled the JDKs as well).

Other issues I encountered in this process:

  1. Eclipse wouldn't start up after uninstalling the JREs. It's resolved using the solution in this SO thread.
  2. Changing the project specific Java Compiler version to 1.8 wouldn't work. That means you have to keep the "Enable project specific settings" checked (right click project name -> Java Compiler), and select project specific "Compiler compliance level" other than 1.8.
Community
  • 1
  • 1
Zhipan
  • 113
  • 1
  • 6
  • Try updating Eclipse to Luna. BTW, which JDK are you using? – Micho Nov 20 '14 at 23:45
  • @Micho I tried Java 5, 6 and 7, but none of them worked. Somebody said Lollipop needed 8, which I tried too, and Eclipse complained about it immediately. I guess JDK is not a problem, since on my Mac both 6 and 7 are fine. Luna is a good idea. I'll give it a shot. – Zhipan Nov 20 '14 at 23:54
  • @Micho Sadly updating to Luna didn't solve my problem:( – Zhipan Nov 21 '14 at 00:24
  • I am facing very similar problem as well. I have to restart Eclipse every time when it does not do anything. There is a very very tiny chance that it can recover to normal from that kind of madness. I have not tried changing the build target tho, I thought something broke up in my system so I downloaded a latest ADK bundle but the problem is still there. Yet in another desktop with the same version of SDK/Eclipse, everything just works fine.. I still have no clue about the cause or the solution.. – Qianqian Nov 25 '14 at 01:56
  • Check your environment path variables and write them in if they're not there. Also, make sure android sdk and eclipse are installed outside of the "Program Files" folder, which has special permissions associated with it on Windows which sometimes prevent Eclipse and the sdk from updating themselves properly. If that doesn't work, then try installing from scratch Android Studio and Android sdk (instead of Eclipse ADT). – Stephan Branczyk Nov 25 '14 at 03:09
  • @StephanBranczyk Thanks for your advice, but I have already got JDK, Android SDK and Android platform tools in the environment path. Also, Android SDK and Eclipse are in their own folders directly under C:\. The folder permissions should be OK, because this only happens to Android 5.0. I'm afraid Android Studio is not an option right now since the project is developed by multiple people, and it's not ready to migrate yet. Any other ideas? – Zhipan Dec 01 '14 at 19:58
  • I would then try re-installing Eclipse ADT and the Android SDK from scratch. Have you done that? – Stephan Branczyk Dec 01 '14 at 22:27

2 Answers2

5

Solved exactly the same problem by moving to JRE 1.8

The hint that this was the problem was getting the following error after setting the project build target to Android 5 & restarting Eclipse:

Parsing Data for android-21 failed unsupported major.minor version 51.0

This is what I did, hope it helps (Windows 7 x64, Eclipse x64, JREs x64):

  1. Uninstall all existing JREs.
  2. Verify that running "cmd" there's no "java" command.
  3. Install JRE 8
  4. Run Eclipse.
  5. "Window" => "Preferences" => "Java" => "Installed JREs" => Verified it points the new folder.
  6. "Window" => "Preferences" => "Java" => "Compiler" => Set to compiler compliance 1.8
  7. Some projects didn't compile, used Right-Click on the project, "Android Tools" => "Fix Project Properties".

Notes:

  1. Make sure to use the right JRE version (x86 vs x64) depending on your Windows & Eclipse version.
sagis
  • 2,162
  • 18
  • 24
0

I have solved it (with multiple JVM installed and without uninstall):

  • First I update android build tools.
  • then install java 1.7 JDK (or JRE, or 1.8....)
  • And then set VM in eclipse.ini, like this:

     -vm
     C:\Archivos de programa\Java\jdk1.7.0_75\jre\bin
     -startup
     plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
     ....
     ....
    

It seems the last android build tools are compile with 1.7 and eclipse need to run with jvm 1.7