Android CyanogenMod source compilation error - android

I've successfully downloaded the CyanogenMod 10 source tree by syncing the latest repo. I've also installed the Java JDK properly and already set a ANDROID_JAVA_HOME variable but still getting those errors while executing this command "make -j4 otatools"
/bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: Permission denied
/bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: Permission denied
/bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-gcc: Permission denied
/bin/bash: build/core/find-jdk-tools-jar.sh: Permission denied
build/core/config.mk:348: *** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com. Stop.
I used these steps to register the downloaded version of Java as an alternative, and switching it to be used as the default
update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_60/bin/java 1
update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_60/bin/javac 1
update-alternatives --set java /opt/jdk1.7.0_60/bin/java
update-alternatives --set javac /opt/jdk1.7.0_60/bin/javac
Output for java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
Output for ANDROID_JAVA_HOME
echo $ANDROID_JAVA_HOME
/opt/jdk1.7.0_60/bin/
My Machine configuration is Debian Wheezy 64 bit with 4GB RAM

Errrrrrrrm, correct me if I'm wrong but looking at your update-alternatives, you are actually setting your Java version to JDK 7
First make sure you have actually Java 6 installed, then try running:
sudo update-alternatives --config java
You should see something like this:
Selection Pad Prioriteit Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-6-oracle/jre/bin/java 1 manual mode
Now type in the version you would like to use, for me that is : 1
type enter and then run java -version
Tell me if it worked!
EDIT: Whoops didn't even notice that this is a thread from 5 months ago...
Sorry for that!
Still Other people who have your problem could find my answer usefull though

Related

Unable to build android due to incorrect java

I have ubuntu 14.04 and I am trying to build android for BBB. I got BBB android and visited this site to get the correct java.
I took android source from this site
http://bbbandroid.sourceforge.net/build.html
then followed steps for java from this site,
https://source.android.com/source/initializing#for-ubuntu-14-04
I did as the site said.
then make -j4 gave this build error,
============================================
Checking build tools versions...
************************************************************
You are attempting to build with an unsupported JDK.
You use OpenJDK but only Sun/Oracle JDK is supported.
Please follow the machine setup instructions at
https://source.android.com/source/download.html
************************************************************
build/core/main.mk:152: *** stop. Stop.
Then I did this
**java -version**
openjdk version "1.8.0_45-internal"
OpenJDK Runtime Environment (build 1.8.0_45-internal-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
**sudo update-alternatives --config java**
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
* 3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press enter to keep the current choice[*], or type selection number: 3
**sudo update-alternatives --config javac**
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/bin/javac 1061 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode
Press enter to keep the current choice[*], or type selection number: 2
again I checked the java -version
openjdk version "1.8.0_45-internal"
OpenJDK Runtime Environment (build 1.8.0_45-internal-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
Its still same as previously.
What is the problem here?
What exactly is supported by google's android, oracle jdk, sun jdk or open jdk?
You need to get the Sun/Oracle JDK, and you are currently using the OpenJDK.
Sun/Oracle JDK is the JDK supported. (Sun is owned by Oracle)
The makefile output answered your question. It must be checking and enforcing the use of Sun/Oracle JDK.
You use OpenJDK but only Sun/Oracle JDK is supported.
Please follow the machine setup instructions at
https://source.android.com/source/download.html
You need to install the Sun/Oracle JDK and then run
sudo update-alternatives --config java
Pick the newly installed version.
I thought I solve this error by reboot computer, make again and the error is gone by unknown reason. But now I just found myself very ridiculous when I try to start the emulator.
Need to re-source to make emulator run with correct environment, see here
xb#dnxb:~/Downloads/android_src/hole$ . build/envsetup.sh
xb#dnxb:~/Downloads/android_src/hole$ lunch aosp_bullhead-userdebug
Now run the emulator:
xb#dnxb:~/Downloads/android_src/hole$ emulator -sysdir out/target/product/generic/ -system out/target/product/generic/system.img -ramdisk out/target/product/generic/ramdisk.img -data out/target/product/generic/userdata.img -kernel prebuilts/qemu-kernel/arm/kernel-qemu-armv7 -memory 2048
emulator: ERROR: Can't access ANDROID_PRODUCT_OUT as '/home/xiaobai/Downloads/android_src/hole/out/target/product/bullhead'
You need to build the Android system before launching the emulator
xb#dnxb:~/Downloads/android_src/hole$
I just realized I only has /home/xiaobai/Downloads/android_src/hole/out/target/product/generic/, no such bullhead (Nexus 5X).
Now I know the reason why I success last time after reboot, this is because of it build with default generic lunch menu aosp_arm-eng, since I didn't redo the steps . build/envsetup.sh and lunch aosp_bullhead-userdebug before rerun make.
And I can see my /etc/environment has this JAVA_HOME set, so sudo update-alternatives --config java never work since /usr/lib/jvm/jdk1.8.0_131/ is Oracle/Sun, not Open JDK (my case is difference with OP, whether requires one of Oracle/Sun or OpenJDK depends on lunch menu):
$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$PATH"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_131/"
Modify the /etc/environment to openjdk path (In Ubuntu, it can be download with sudo apt-get install openjdk-8-jdk, then use dpkg -L openjdk-8-jdk to locate the path ), open a new tab shell session, redo the . build/envsetup.sh, lunch aosp_bullhead-userdebug, and make, now it works without jdk error.

Check API problme when compiling Android (checkapi-current-timestamp)

I got the following error while compiling android source code for the first time on Ubuntu 12.04, I have not chenged the source code at all abd suggested command in error "make update-api" didn't help me
repo sync
source build/envsetup.sh
lunch full-eng
make
http://pastebin.com/5gEjkTLV
As the problem is in the java part here is my java installation information. I downloaded jdk-6u39-linux-x64.bin and run it and copy the file into /usr/lib/jvm/jdk1.6.0_39/ and set the this java as the main java application by :
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_39/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_39/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.6.0_39/bin/javaws" 1
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
here is the result:
echo $JAVA-HOME
/usr/lib/jvm/jdk1.6.0_39/
java -version
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)
javac
javac 1.6.0_39
Look at the dump again. you need to regenerate api/current.txt. You need to run make update-api to regenerate that file. You should be able to build again after that .
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "#hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************

Tools.jar is not in Android Studio classpath

I tried installing Android Studio on a Samsung Chromebook Series 3 with an ARM processor, but I'm stuck with the Java. Any help would be appreciated.
Downloaded and extracted Android Studio
Downloaded and extracted Java 1.7.0_21 JDK ARM
Completed the below commands except the javaws commands as they error-ed out doesn't exist
tar xzvf ~/Downloads/jdk-7u21-linux-arm.tar.gz sudo mv jdk1.7.0_21/ /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_21/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_21/bin/javac 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_21/bin/javaws 1
sudo update-alternatives --config java
sudo update-alternatives --config javaws
I tried the JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21 command and it would still give me the error.
Please check whether your system configuration is 32bit or 64bit and according to that download respective JDK and provide its path in JAVA_HOME
No It's not in the studio. What you should do:
Change your JRE to use the JRE found inside your JDK
Add tools.jar that can be found in the JDK Libraries folder
That's it. It's a known issue, but they're working on it. But this is a workaround.
Couple of things, you can check:
1. check jdk is in your path
2. from your command line, execute this command: java -version
and see what it shows
3. and execute this command: javac -version
If both command gives no error then try again otherwise fix those issue.btw, Do not forget to check your system configuration to make sure that it is 32bit or 64 bit

Compile Android source on Ubuntu 12.04 cannot continue because of bad JDK version

I've been trying all day to compile the Android source code on my Ubuntu 12.04 64bit OS.
For some reason, I'm stuck on the phase of having the Sun/Oracle JDK 1.6 version installed. I've been trying many commands (and the official link of course) and I end up either having nothing, having JDK 1.7 or OpenJDK, or not having the jdk-tools.
What are the exact steps to successfully compile the code (or part of it) using JDK? I'm stuck at the phase of "make j4" on this link.
installing the proper java version(1.6) for android do the below
1) Installing JDK
Since Sun JDK is no longer in Ubuntu’s main package repository, we have to manually install it in ubuntu 12.04 from oracle website
Please go the below link and download the JDK
http://www.oracle.com/technetwork/java/javase/downloads/jdk6-downloads-1637591.html
Follow the below steps to install the java and configuring it for the usage
$ chmod +x jdk-6u33-linux-x64.bin
$ sudo ./jdk-6u33-linux-x64.bin
$ sudo mv jdk1.6.0_33 /usr/lib/jvm/
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_33/bin/java 1
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_33/bin/javac 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_33/bin/javaws 1
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config javaws
To verify the isntallation is proper do the belwo steps. It should now show that the Sun JDK is running instead of IcedTea
$ java -version
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03, mixed mode)
For compiling android on ubuntu 12.04 and installing the proper java version
visit http://www.embeddedcircle.com/android-compilation-in-ubuntu-12-04-lts-precise-for-pandaboard/
thanks
dino
In Ubuntu, when you download the jdk (32-bit version if it is for android programming, and in my opinion better the tar.gz than the .rpm one) it is important to 'install' and also to export using the commands you can see in the page of Oracle if I'm not wrong. You also need to go to your editor (Eclipse, Netbeans or which one?) and add the new Java platform to make sure you are using the version of the JDK you want to.To export means that you can compile the project when you want to.If not,you have to go to the java directory and inside the /bin folder do the command (probably with sudo at the beginning) to compile your project.
P.S.: You can find how to export here
I got this same problem. Some people reporting even JDK SE will see errors.
Another work-around is modifying two lines of source code, see here:
https://github.com/CyanogenMod/android_external_guava/commit/c8b97210aa31c9b80b5fd136d8617ebe4e731e09

Android ICS Compilation Issue

I successfully Downloaded the source code for Android 4.0.3.
But I am unable to compile it on my machine.
My Machine configuration is UBUNTU 11.10 64 bit,4 GB RAM
When I am running the lunch command getting the following error.
/bin/bash: prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc: Permission denied
/bin/bash: prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc: Permission denied
/bin/bash: prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc: Permission denied
/bin/bash: build/core/find-jdk-tools-jar.sh: Permission denied
build/core/config.mk:268: *** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com. Stop.
** Don't have a product spec for: 'full'
** Do you have the right repo manifest?
JDK is already in a path.When I Run the Command java -version I am getting following OutPut
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
Can Anyone Help to proceed?
If you check the script build/core/find-jdk-tools-jar.sh, you can see that it first checks an environment variable called ANDROID_JAVA_HOME. If you set the ANDROID_JAVA_HOME environment variable to your JDK path, it should fix this error.
This is caused by build/core/find-jdk-tools-jar.sh with wrong result for "which javac".
Usually, this is caused by javac is not configured as a alternative for system. So there is no link of /usr/bin/javac for your javac.
Please setup the alternative for javac:
$sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_32/bin/javac" 1
note: the installed directory of javac for me is "/usr/lib/jvm/jdk1.6.0_32/", you can change it by your configuration.
You are trying to run 32-bit binaries (the NDK toolchain) on a 64-bit OS, so first make sure you have the 32-bit compatibility libs installed:
sudo apt-get install ia32-libs
If that doesn't solve it, then make sure you do have execute permission on those files.
-Open terminal
-type: chmod 777 WORKING_DIR -R
-this will fix the error

Categories

Resources