Android Studio requires Java 1.8 or above. Current JDK version 1.7 - General Questions and Answers

That's the error I get when I open Android Studio, except when I type javac -version in terminal, it says javac 1.8.0_101
.
What should I do?

Related

Building Eclair from source - java problem

I'm trying to build Eclair from source using instructions here:
http://source.android.com/download
And here:
http://source.android.com/documentation/building-for-dream
It does not build and java crashes out with an exception error:
Code:
Note: Recompile with -Xlint:deprecation for details.
target Java: VpnServices (out/target/common/obj/APPS/VpnServices_intermediates/classes)
An exception has occurred in the compiler (1.5.0). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: writePool E
at com.sun.tools.javac.jvm.ClassWriter.writePool(ClassWriter.java:513)
at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1333)
at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1211)
at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:325)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:474)
at com.sun.tools.javac.main.Main.compile(Main.java:592)
at com.sun.tools.javac.main.Main.compile(Main.java:544)
at com.sun.tools.javac.Main.compile(Main.java:58)
at com.sun.tools.javac.Main.main(Main.java:48)
make: *** [out/target/common/obj/APPS/VpnServices_intermediates/classes-full-debug.jar] Error 41
make: *** Waiting for unfinished jobs....
I am using java 1.5.0 as suggested on the AOSP site.
Code:
java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
My system is Ubuntu 9.10 32bit.
Are there any tips to get this working? Is this the best version of Java to use?
I was getting a ton of errors with 1.5, I started building with Java 1.6 but I had to stop it. It was definitely getting further.
I have also heard that if you use Java 1.6, you should first run a
Code:
make update-api
and then run
Code:
make

SDK installation issue

Hi, I downloaded the android sdk from the official site, and when I launch eclipse, it gives me this error:
Code:
[email protected] ~/adt-bundle-linux-x86/eclipse $ ./eclipse
Eclipse:
JVM terminated. Exit code=13
/usr/bin/java
-Dosgi.requiredJavaVersion=1.6
-XX:MaxPermSize=256m
-Xms40m
-Xmx768m
-Declipse.buildId=v21.0.1-543035
-jar /home/xacobe/adt-bundle-linux-x86/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
-os linux
-ws gtk
-arch x86
-showsplash
-launcher /home/xacobe/adt-bundle-linux-x86/eclipse/eclipse
-name Eclipse
--launcher.library /home/xacobe/adt-bundle-linux-x86/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.200.v20120522-1813/eclipse_1502.so
-startup /home/xacobe/adt-bundle-linux-x86/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.overrideVmargs
-exitdata 288006
-product com.android.ide.eclipse.adt.package.product
-vm /usr/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.6
-XX:MaxPermSize=256m
-Xms40m
-Xmx768m
-Declipse.buildId=v21.0.1-543035
-jar /home/xacobe/adt-bundle-linux-x86/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
The java version is the correct
Code:
[email protected] ~/adt-bundle-linux-x86/eclipse $ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12.10.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
I don't know why is this error, can anyone help? Thanks :good:
I'm trying to install eclipse and sdk separately, i just made the sdk work
I needed ia32-libs to make everything work, cause my computer is 64. Then i downloaded the Eclipse IDE for Java Developers, and it works! Finally i installed the plugin and pointed eclipse to the sdk. If someone have this same problem, here is the solution

AOSP now requires Java 7, and works with OpenJDK

I was just looking at the build instructions page for AOSP and noticed a significant change that must've just happened in the last week or so. Apparently Java 7 is now required, and Google officially recommends using OpenJDK. Under where it says "To develop for older versions..." it lists Java 6 next to KitKat, meaning this is apparently for code newer than KitKat. I don't think OpenJDK was compatible before, so that plus the move to Java 7 seems noteworthy. Can anybody who watches AOSP commits comment on when this change occurred? Is this signifying a non-minor update is coming after KitKat?
For reference, here is the relevant text of the current page at http://source.android.com/source/initializing.html:
Code:
Installing the JDK
The latest version of Android in the Android Open Source Project (AOSP) requires Java 7. On Ubuntu, use OpenJDK.
Java 7: For the latest version of Android
$ sudo apt-get update
$ sudo apt-get install openjdk-7-jdk
Optionally, update the default Java version by running:
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
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
And this is what it said on Feb. 16 according to Wayback Machine:
Code:
Installing the JDK
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.
Java 6: for Gingerbread and newer
$ sudo add-apt-repository "deb [url]http://archive.canonical.com/[/url] lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
Java 5: for Froyo and older
$ sudo add-apt-repository "deb [url]http://archive.ubuntu.com/ubuntu[/url] hardy main multiverse"
$ sudo add-apt-repository "deb [url]http://archive.ubuntu.com/ubuntu[/url] hardy-updates main multiverse"
$ sudo apt-get update
$ sudo apt-get install sun-java5-jdk
xdp said:
Can anybody who watches AOSP commits comment on when this change occurred? Is this signifying a non-minor update is coming after KitKat?
Click to expand...
Click to collapse
Here's the change: https://android.googlesource.com/platform/build/+/c84889b80ae40dec85ac4810fc500db70cbc82b2
Since this is already online, I wouldn't expect this to be a sign for a big update. One of the beasts that needed JDK6 was chromium. I took a quick look into the changes and didn't see really much. Only some fixes to be able to compile with JDK7. I'll give it a try if it compiles.
So has anyone meanwhile successfully built Lollipop with OpenJDK?

[Q] Cannot install Eclipse to load Lollipop.

Hey Everyone,
I hope you can help me... I'm trying to install the Android Eclipse ADT Bundle, and I keep getting the following pop-up whenever I try to run the Eclipse executable:
---------------------------
Eclipse
---------------------------
Java was started but returned exit code=13
C:\ProgramData\Oracle\Java\javapath\javaw.exe
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar C:\Dev\adt-bundle-windows-x86_64-20140702\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
-os win32
-ws win32
-arch x86_64
-showsplash C:\Dev\adt-bundle-windows-x86_64-20140702\eclipse\\plugins\org.eclipse.platform_4.4.0.v20140925-0400\splash.bmp
-launcher C:\Dev\adt-bundle-windows-x86_64-20140702\eclipse\eclipse.exe
-name Eclipse
--launcher.library C:\Dev\adt-bundle-windows-x86_64-20140702\eclipse\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326\eclipse_1603.dll
-startup C:\Dev\adt-bundle-windows-x86_64-20140702\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.appendVmargs
-exitdata 2f1c_60
-product org.eclipse.epp.package.java.product
-vm C:\ProgramData\Oracle\Java\javapath\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar C:\Dev\adt-bundle-windows-x86_64-20140702\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
---------------------------
OK
---------------------------
Any ideas as to what I'm doing wrong?
Thank you!
Eamon

[HOW-TO] Quick Guide on How to Compile Heimdall from Source in MacOS - OSX Yosemite

So, I was able to compile and flash my Galaxy J5 from my Mac OSX Yosemite command line, and I'd like to share the experience. I'm a beginner at flashing and the Android world, so I struggled to understand I did not need Odin for taking control over my Galaxy J5.
The following should work for most versions of OSX / MacOS, as long as you have a compiler installed. But I've only tested it in my Yosemite machine.
All binary packages for Heimdall did not work for me. I was getting a persistent "libusb error -7 whilst sending packet". So I decided to build everything from source and forget about Odin, JOdin3 and the like.
I already had a development environment setup in my Mac, with the stock Xcode cc compiler. So I can only relate the additional dependencies I had to install (+ GIT). But it could be that I had additional software that is required from my brew installed packages. At the end of the post I list all my brew installed packages just in case.
1) Make sure you have a compiler (Xcode dev tools) installed. This is standard Apple stuff. Just google "install xcode mac" for your Mac version.
2) Install Homebrew (url is brew.sh), and the following packages:
Code:
brew install git
brew install cmake
3) Build libusb from source
Code:
cd /tmp
git clone https://github.com/libusb/libusb
cd libusb
./autogen.sh
make
cd /tmp
4) Build Heimdall
Code:
cd /tmp
git clone https://github.com/Benjamin-Dobell/Heimdall
cd Heimdall/
cmake -DLIBUSB_LIBRARY=/tmp/libusb/libusb -DLIBUSB_INCLUDE_DIR=/tmp/libusb/libusb -DDISABLE_FRONTEND=1 .
make
5) If you had no errors in the previous make steps, run Heimdall. You ca print your PIT, flash, etc, from the command line and never use Odin AFAIK. Take your phone into "Download Mode" (Vol Down + Home + Power button from a powered down state). Then try the print-pit Heimdall command (which takes a few minutes to complete).
Code:
cd /tmp/Heimdall/bin
sudo ./heimdall print-pit --no-reboot
sudo ./heimdall flash --17 recovery.img
etc....
BTW, move both Heimdall and libusb directories out of /tmp/ if you intend to preserve them after your Mac reboots. Create something like /Users/[your_user]/build/ to keep it safe and replave all "/tmp/" dirs in the lines above with your destination directory.
Have fun!
=====================
The following is a list of all my brew-installed packages, just in case you're missing a dependency and not sure which package I had that could make this work in my machine.
Code:
~/dev/build/Heimdall$ brew list
android-sdk gifsicle id3lib meld redis
atk git imagemagick net-snmp ruby
autoconf glew jbig2dec netcat scala
automake glib jpeg nettle sdl2
boost glm lame nexus sdl2_image
brew-cask gmp libepoxy nmap sqlite
cairo gnome-icon-theme libev node texi2html
cmake gnu-sed libffi openssl tig
cscope gnupg libogg p7zip tree
d-bus gnutls libpng pango unrar
ffmpeg go libtasn1 pcre v8
fontconfig gobject-introspection libtiff phantomjs watch
freetype gource libtool pixman webp
gawk gsettings-desktop-schemas libvo-aacenc pkg-config wget
gd gtk+3 libvorbis py2cairo x264
gdbm gtksourceview3 libvpx pygobject3 xvid
gdk-pixbuf harfbuzz libyaml python xz
geoip hicolor-icon-theme little-cms2 qemu yasm
gettext httrack macvim qt5
ghostscript icu4c maven readline

Categories

Resources