简体   繁体   中英

Android compiling - wrong Java version

I have tried to build Android according to this guide

sudo apt-get update
sudo apt-get install openjdk-6-jdk //just because installer want java 6'

I deleted other versions of jJava, but when I tried to make it I got this error:

You are attempting to build with the incorrect version of java. Your version is: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar . The correct version is: Java SE 1.6. Please follow the machine setup instructions at http://source.android.com/source/download.html

What is wrong?

You can have multiple java version on your machine and use only one at a time. Check this blog: Multiple java versions on single machine to build different AOSP (Android Frameworks) on Ubuntu

OpenJDK and Java JDK are different things.

As Initializing a Build Environment mentioned:
The master branch of Android in the Android Open Source Project (AOSP) requires Java 7. On Ubuntu, use OpenJDK.

To develop older versions of Android, download and install the corresponding version of the Java JDK:

  • Java 6: for Gingerbread through KitKat
  • Java 5: for Cupcake through Froyo

It's being discussed here: https://groups.google.com/forum/#!topic/android-building/VKj-Nbu8y10

Basically it's the env "JAVA_TOOL_OPTIONS" being checked in Android Makefile. $ aptitude search jayatana i jayatana - Java Native Library for ayatana project

You just need to unset it for the time being, or remove it if you don't need it at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM