I'm trying to build different version AOSP and android in ubuntu 14.04. However, I need to switch between different versions of OpenJDK and JAVA SE JDK.
I know I can use update-alternative to deal with different installation. But, JAVA SE JDK doesn't appear in update-alternative. It's just the contents of a tar ball.
Could anyone suggest a better to deal with different tools for building different targets?
By default when you build AOSP it will use your JAVA_HOME which is really frustrating when they are stuck on 1.6 and everyone else is using 1.7.
AOSP will look for an environment variable ANDROID_JAVA_HOME before it builds, so you can set this prior to building and have it point at a different location. This doesn't seem to work on all versions of Android, it definitely does not work on my Marshmallow build, but if it does work it might be more convenient for you.
Go and manually pick up the version of java you need from Oracle, and then find some convenient way to call export JAVA_HOME=/path/to/java/ . I always use 1.6 because I am not building master yet so I just put it into my .bashrc, but you could just put it in a build script.
You can add your JDK installation into update-alternative manually.
How you can achieve that:
download JDK you need, e.g. jdk-6u45-linux-x64.bin
extract it; for example, chmod +x jdk-6u45-linux-x64.bin && ./jdk-6u45-linux-x64.bin
move it in the place you want; personally I prefer /opt, so sudo mv jdk1.6.0_45 /opt
you can skip this step, but I'd recommend using symbolic links sudo ln -fs /opt/jdk1.6.0_45 /opt/jdk1.6
add manually this version sudo update-alternatives --install /usr/bin/java java /opt/jdk1.6/bin/java 1
Note: I'm using symbolic links there.
Then you can always change current JDK with
sudo update-alternatives --config java.
And then you can check current version of Java being used in the system.
>java - version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
More information you can find in manual page of update-alternatives.
I had the same issue to switch between JDK version which is not coming in update-alternative. I already had JDK 7 and I want to switch to KDK 6. I had downloaded JDK 6 as .bin and installed. But it is not shown in update-alternative. At last I found the solution which is worked for me.
I installed update-java-0.5b which will open GUI which is useful to switch between JDK version.
wget http://webupd8.googlecode.com/files/update-java-0.5b
chmod +x update-java-0.5b
sudo ./update-java-0.5b
Hope it will help!!
Related
I download android open source project from Here
After downloaded, I used this command to clean UP etc...
$ make clobber
Then i got this problem
build/core/main.mk:42: ********************************************************************************
build/core/main.mk:43: * You are using version 4.1 of make.
build/core/main.mk:44: * Android can only be built by version 3.81.
build/core/main.mk:45: * see http://source.android.com/source/download.html
build/core/main.mk:46: ********************************************************************************
I got make 4.1 default from android open source project
I'm using ubuntu 18.04 LTS
Excepted solution
How to downgrade 4.1 to 3.81
I can't able to install 1.6 JDK
I know that hell of dependencies to build AOSP, I live on Arch Linux and working build may fail after a system update.
So now I'm using docker image with all deps preinstalled, without a need to upgrade system there, keeping my desktop Arch Linux independent.
Just some results after googling:
https://github.com/stucki/docker-lineageos (I used this one, but the next one may be a better choice)
https://github.com/jfloff/docker-lineageos
https://hub.docker.com/r/anthodingo/docker-lineageos/
Also you may be interested to know that there's a Linux distro dedicated to AOSP development: http://bbqlinux.org/
As in the requirement say you should use
Just download it from gnu.org. Here are the requirements for building AOSP
For your JDK you should run this:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
Don't forget to uninstall everything JDK, Make before you install the new ones.
Well, as the question says I have some trouble getting RAPT to run the command:
python android.py installsdk
It usually returns:
I'm compiling a short test program, to see if you have a working JDK
on your system.
I was unable to use javac to compile a test file. If you haven't
installed the Java Development Kit yet, please download it from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
The JDK is different from the JRE, so it's possible you have Java
without having the JDK. Without a working JDK, I can't continue.
I have tried many versions of JDK, I have checked the variable "PATH" and I can run javac with no problem. I need a specific version of JDK? (I´m using Python 2.7, 32 bits)
JDK is java development tool kit
JRE is java run-time environment only.
If you have compiled java jar or class file jre is good enough, you do not require jdk.
but if you want to compile java source code you will require javac that comes with JDK.
Try setting JAVA_HOME environment variable.
I am currently trying to compile a qt project to run on an android tablet and the build process works as expected, but when I try to deploy it, it quits saying it can't find the javac compiler because JAVA_HOME is set to the place where the JRE resides.
I have already tried adding JAVA_HOME to the build environment in Qt Creator, then in the/etc/profile file and finally outputting the JAVA_HOME variable from the script that starts ant and they all point to the correct path.
I have also tried to grep through all the files for the JRE path string literal, but this didn't yield any results.
You'd want to install the JDK. Just the JRE won't be enough.
This is because only the JDK has the Java compiler, JRE is just the Java Runtime Environment.
After a few unsuccessful attempts I found that it was in fact looking for the tools.jar file that got moved to another location in openjdk 7, even though the error messages were referring to JAVA_HOME.
I installed openjdk 6 and it works now
I am running openSUSE 12.2 64-bit trying to compile an app in Necessitas alpha 4.1. It's a basic app and the code is likely not the issue. Through the course of tracing the issue I made sure to have all dependencies and tools.jar, which can apparently cause similar errors. When compiling I get:
Packaging Error: Command '/usr/bin/ant clean debug' failed.Exit code: 1
File not found:
No file is actually listed. I copy/pasted this line from Projects->Build Steps->qmake:
/home/mark/Software/necessitas/Android/Qt/482/armeabi-v7a/bin/qmake /home/mark/Dev/qt/myProject/myProject.pro -r -spec android-g++ CONFIG+=debug CONFIG+=declarative_debug
Then I pasted in a terminal window and the result is:
sh: /home/mark/necessitas/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: No such file or directory
This is obviously incorrect as my path is ~/Software/necessitas not ~/necessitas. I have checked through every tab of Tools->Options but see nowhere that references the incorrect folder. Any clue where this is supposed to go?
I had this exact error last night. However I noticed that the Google documentation specifically said java-6-openjdk. So I installed the older JDK using synaptic and then ran:
sudo update-alternatives --config java
I selected the version 6 and re-ran the process. Which completed successfully.
(To be fair I was using Qt 5.1 beta 1 and freshly downloaded NDK and SDK's, ant was 1.8.1 from the repositories)
Were you able to resolve your problem in the mean time ?
This has to do with the Java environment variables, more precisely with JAVA_HOME.
Did you install OpenJDK right before you tried to launch your app ?
I am not certain where OpenJDK installs in OpenSUSE, but on my ArchLinux the variable had to be set to :
JAVA_HOME=/usr/lib/jvm/java-7-openjdk
in order for QtCreator to compile the project properly.
In my case, I had Oracle's JDK installed, so right after installing OpenJDK, loging out and reloging updated my environment variables as wished.
There is also a similar post to yours:
How to build my HelloWorld Android application with Necessitas (qt port)?
And you'll find a good necessitas starter video here :
http://youtu.be/suPeZ7XC1xk
I have downloaded android-sdk_r08-windows.zip and installed it in c:\. When I try to run the SDK Manager, it briefly pops up a DOS window then closes. Trying to run adroid update sdk results in a null pointer exception. I have tried uninstalling/reinstalling the SDK for both android and java multiple times. This is on windows XP SP3. Any ideas?
Thanks,
John
C:\android-sdk-windows>java -version
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
C:\android-sdk-windows>tools\android.bat update sdk
[INFO] Starting Android SDK and AVD Manager
No command line parameters provided, launching UI.
See 'android --help' for operations from the command line.
java.lang.NullPointerException
at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1155)
at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1134)
at com.android.sdklib.internal.avd.AvdManager.<init>(AvdManager.java:376)
at com.android.sdkuilib.internal.repository.UpdaterData.initSdk(UpdaterData.java:230)
at com.android.sdkuilib.internal.repository.UpdaterData.<init>(UpdaterData.java:107)
at com.android.sdkuilib.internal.repository.UpdaterWindowImpl.<init>(UpdaterWindowImpl.java:86)
at com.android.sdkuilib.repository.UpdaterWindow.<init>(UpdaterWindow.java:54)
at com.android.sdkmanager.Main.showMainWindow(Main.java:297)
at com.android.sdkmanager.Main.doAction(Main.java:260)
at com.android.sdkmanager.Main.run(Main.java:99)
at com.android.sdkmanager.Main.main(Main.java:88)
Apparently my system had a residual .android folder lying around from when I played around with the android SDK over a year ago. Renaming that file resulted in the SDK Manager coming up.
Make sure the JDK path is added to the Environmental variables.Its usually happenes when a JDK/JRE uninstall is succeeded by another JDK install
Have you installed the JDK, rather than the JRE?
Also, check that your JAVA_HOME variable points to your JDK install path.
instead of opening android sdk manager open android.bat in tools folder. i think it is sdk\tools
You need make sure that:
1) JDK or JRE is installed
2) Within System Variables, the JAVA_HOME variable is set to your JDK/JRE folder (e.g. C:\Program Files\Java\jre7)
3) Your PATH variable includes %JAVA_HOME%\bin