溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

android 源碼編譯相關(guān)

發(fā)布時(shí)間:2020-07-25 21:32:42 來源:網(wǎng)絡(luò) 閱讀:19408 作者:CamilleIT 欄目:移動開發(fā)

1 在ubuntu中編譯android6.0時(shí)需要openjdk7, 但是openjdk-7-jdk 和openjdk-7-jre需要同時(shí)安裝。

 $sudo apt-get install openjdk-7-jre

 $sudo apt-get install openjdk-7-jdk


PS: openjdk-7-jre包只包含Java運(yùn)行時(shí)環(huán)境(Java Runtime Environment)。如果是要開發(fā)Java應(yīng)用程

序,則需要安裝openjdk-7-jdk包。


2 在ubuntu中更新jdk鏈接


Installing Oracle JDK 8 on Ubuntu:

Extract the tar file:

tar -xvzf jdk-8-linux-x64.tar.gz

Create jvm folder in /usr/lib, if jvm folder not exist

sudo mkdir /usr/lib/jvm

Move extracted jdk 8 folder to this location:

sudo mv jdk1.8.0 /usr/lib/jvm/jdk1.8.0

Install new java source in system:

sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.8.0/bin/javaws 1


Choose default java:

sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws


Java version test:

java -version

參考鏈接 http://www.devsniper.com/install-jdk-8-on-ubuntu/


3 android N 編譯

1)編譯錯(cuò)誤

Java heap spaceTry increasing heap size with java option '-Xmx<size>'Warning: This may have produced partial or corrupted output.ninja: build stopped: subcommand failed.build/core/ninja.mk:146: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

解決方案: 在文件 out/host/linux-x86/bin/jack-admin 添加 值


export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation "
然后重啟
out/host/linux-x86/bin/jack-admin kill-server
out/host/linux-x86/bin/jack-admin start-server

5 編譯andorid orea,內(nèi)存不夠:
解決方案:
The problem is that virtual machine which runs jack doesn't have enough memory.
You can try to edit jvm command:JACK_VM_COMMAND=${JACK_VM_COMMAND:="java -Xmx4096m"}
or to decrease number of parallel jack compilationsSERVER_NB_COMPILE=2
in  file.
You can read jack documentation for details.EDIT:
Changing .jack file didn't work for me.
After digging a little deeper I found that jack server is started with 
out/host/linux-x86/bin/jack-admin script and it's parameters can be 
passed with JACK_SERVER_VM_ARGUMENTS environment variable.So my solution was 
to set it and restart jack server before building aosp 
:

      6在android8orea, cts中添加第三方j(luò)ar包:LOCAL_STATIC_JAVA_LIBRARIES :=poi(在compatibility-host-util andorid.mk 文件中

make cts時(shí),出現(xiàn)錯(cuò)誤: 

ninja: error: '/media/camille/android_src/out/androidOrea/host/common/obj/JAVA_LIBRARIES/poi_intermediates/classes.jar', needed by '/media/camille/android_src/out/androidOrea/host/common/obj/JAVA_LIBRARIES/compatibility-host-util_intermediates/classes-full-debug.jar', missing and no known rule to make it

15:00:20 ninja failed with: exit status 1

build/core/main.mk:21: recipe for target 'run_soong_ui' failed

make: *** [run_soong_ui] Error 1

說明編譯package compatibility-host-util 需要poi_intermediates下的文件classes.jar。

解決方法: 復(fù)制一份poi_intermediates下的文件javalib.jar, rename to classes.jar。再次編譯,就可以了。


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI