android N 编译
环境配置
需要使用openjdk 8,所以,有两种方法:
方法一: sudo apt-get update; sudo apt-get install openjdk-8-*
先确保/etc/apt/source.list正确,update不出错。
甲骨文官网上的jdk不行,它是jdk se,不适用于我正在使用的平台 android N 的编译。
注:
Ubuntu版本低于14.04(含)的需要通过以下步骤安装:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac
3、编译问题处理
遇到最后显示ninja的,如果不能立即找出错误,搜索jack关键字,多是因为jack不能正确开启、运行有关的。
问题一:
Starting build with ninja
ninja: Entering directory `.'
ninja: error: 'out/target/product/msm8953_64/obj_arm/SHARED_LIBRARIES/libqct_resampler_intermediates/export_includes',
needed by 'out/target/product/msm8953_64/obj_arm/SHARED_LIBRARIES/libaudioresampler_intermediates/import_includes',
missing and no known rule to make it
make: *** [ninja_wrapper] Error 1
解决:配置好java环境和jack_vm_args。
# set java 8
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export JRE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
# set for android N build
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
echo "ANDROID_JACK_VM_ARGS=$ANDROID_JACK_VM_ARGS"
问题二:
FAILED:Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log
No Jack server running. Try 'jack-admin start-server'
……
ninja: build stopped: subcommand failed.
make[1]: *** [ninja_wrapper] Error 1
解决:
A:prebuilts/sdk/tools/jack-admin 文件,在 JACK_SERVER_COMMAND=“…… -cp ……” -cp 前添加-Xmx7000m(7000m为内存大小的一半左右,根据所用的主机配置而定)
测试jack-admin kill-server/start-server 命令,看start-server是否能够成功运行。
B:通过查看文件 $HOME/.jack-server/logs/jack-server-*.log
“ServerException: './config.properties' musthave permission rw------- but have rwx------
Caused by: java.io.IOException: './config.properties' must have permissionrw------- but have rwx------”
如果有权限问题,根据提示修改对应文件的权限即可。不过我没遇到过
问题三(这log我没遇到过):
com.android.jack.server.api.v01.ServerException: Problem while opening service port
at com.android.jack.server.JackHttpServer.start(JackHttpServer.Java:611)
at com.android.jack.server.JackServerImpl.run(JackServerImpl.java:62)
at com.android.jack.launcher.ServerLauncher$3.run(ServerLauncher.java:391)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.BindException: Address already in use
……
解决:
需要同时修改 $HOME/.jack-server/config.properties 和 $HOME/.jack-setting 中的端口号,方才有效,
可以在别的用户启动了jack server的情况再启动另一个jack server,这样就可以实现多用户同时编译,
jack.server.service.port=8076
jack.server.admin.port=8077
以上,若有帮助,点个赞咯~
###############################################################################################
下面是搜的英文资料,但是并没有解决上面的共性问题,可做尝试,毕竟大家遇到的情况可能不同,有人曾解决过自己的问题
sudo aptitude install libcurl4-openssl-dev nss-updatedb
Also, jack server doesnt start if you only delete the '.jack-server' folder (found out that you must also clear the 'out' folder
in that case, otherwise the folder doesnt get rebuilt).
I think I finally found a neat and elegant solution - just turn off the damn jack server in build/core/configure_local_jack.mk
by changing the line:
LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
into:
LOCAL_JACK_ENABLED := #$(strip $(LOCAL_JACK_ENABLED))
转载自:
android N 编译
环境配置
需要使用openjdk 8,所以,有两种方法:
方法一: sudo apt-get update; sudo apt-get install openjdk-8-*
先确保/etc/apt/source.list正确,update不出错。
甲骨文官网上的jdk不行,它是jdk se,不适用于我正在使用的平台 android N 的编译。
注:
Ubuntu版本低于14.04(含)的需要通过以下步骤安装:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac
3、编译问题处理
遇到最后显示ninja的,如果不能立即找出错误,搜索jack关键字,多是因为jack不能正确开启、运行有关的。
问题一:
Starting build with ninja
ninja: Entering directory `.'
ninja: error: 'out/target/product/msm8953_64/obj_arm/SHARED_LIBRARIES/libqct_resampler_intermediates/export_includes',
needed by 'out/target/product/msm8953_64/obj_arm/SHARED_LIBRARIES/libaudioresampler_intermediates/import_includes',
missing and no known rule to make it
make: *** [ninja_wrapper] Error 1
解决:配置好java环境和jack_vm_args。
# set java 8
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export JRE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
# set for android N build
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
echo "ANDROID_JACK_VM_ARGS=$ANDROID_JACK_VM_ARGS"
问题二:
FAILED:Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log
No Jack server running. Try 'jack-admin start-server'
……
ninja: build stopped: subcommand failed.
make[1]: *** [ninja_wrapper] Error 1
解决:
A:prebuilts/sdk/tools/jack-admin 文件,在 JACK_SERVER_COMMAND=“…… -cp ……” -cp 前添加-Xmx7000m(7000m为内存大小的一半左右,根据所用的主机配置而定)
测试jack-admin kill-server/start-server 命令,看start-server是否能够成功运行。
B:通过查看文件 $HOME/.jack-server/logs/jack-server-*.log
“ServerException: './config.properties' musthave permission rw------- but have rwx------
Caused by: java.io.IOException: './config.properties' must have permissionrw------- but have rwx------”
如果有权限问题,根据提示修改对应文件的权限即可。不过我没遇到过
问题三(这log我没遇到过):
com.android.jack.server.api.v01.ServerException: Problem while opening service port
at com.android.jack.server.JackHttpServer.start(JackHttpServer.Java:611)
at com.android.jack.server.JackServerImpl.run(JackServerImpl.java:62)
at com.android.jack.launcher.ServerLauncher$3.run(ServerLauncher.java:391)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.BindException: Address already in use
……
解决:
需要同时修改 $HOME/.jack-server/config.properties 和 $HOME/.jack-setting 中的端口号,方才有效,
可以在别的用户启动了jack server的情况再启动另一个jack server,这样就可以实现多用户同时编译,
jack.server.service.port=8076
jack.server.admin.port=8077
###############################################################################################
下面是搜的英文资料,但是并没有解决上面的共性问题,可做尝试,毕竟大家遇到的情况可能不同,有人曾解决过自己的问题
sudo aptitude install libcurl4-openssl-dev nss-updatedb
Also, jack server doesnt start if you only delete the '.jack-server' folder (found out that you must also clear the 'out' folder
in that case, otherwise the folder doesnt get rebuilt).
I think I finally found a neat and elegant solution - just turn off the damn jack server in build/core/configure_local_jack.mk
by changing the line:
LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
into:
LOCAL_JACK_ENABLED := #$(strip $(LOCAL_JACK_ENABLED))