在工程的编译过程中会出现一些错误
一、报错出现了
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj/lib/libc++.so' failed
解决方案:
1.art/build/Android.common_build.mk中把true改为false
# Host. ART_HOST_CLANG := false ifneq ($(WITHOUT_HOST_CLANG),false) #ture--->false # By default, host builds use clang for better warnings. ART_HOST_CLANG := ture endif
2 执行命令,更改链接指向
ln -sf /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
实在不行,可以执行 make update-api
sudo apt-get update
sudo apt-get upgrade
折腾了好久之后,我的工程就编译通过了
二、报错出现了
vendor/qcom/proprietary/mm-still/ipl/Android.mk:16 recipe commences before first target。 停止
解决方法:
打开 vendor/qcom/proprietary/mm-still/ipl/Android.mk: 发现原来是15行缺少换行符
将 -D__alignx/(x/)=__attribute__/(/(__aligned__/(x/)/)/) 改为
-D__alignx/(x/)=__attribute__/(/(__aligned__/(x/)/)/) /
三、执行命令 ./gradlew tasks时出现错误
Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
Required by:
project :* Try:
Run with –stacktrace option to get the stack trace. Run with –debug option to get more log output.
解决方法:在project的builde.gradle做如下操作分别加上google(),因为关于gradle的升级后,所需要的开源库,不一定在jcenter()库中能找到,可以在google()服务器上找到相应的开源库
四、执行命令 ./gradlew assemble 编译自己的工程的时候 出现错误
java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.BUILD FAILED
注:在AS中直接点击run按钮,或者builde按钮,是不会报错的,这是因为AS会有默认的java版本
五、AS中builde生成的apk,通过从设备中pull下来,反编译后,就可以在manifest的文件中,看到testOnly= true的属性,这表示不能通过install命令来安装设备中 ,而直接使用./gradlew assemble 编译出来的apk没有该属性,是可以通过install命令到安装到任何设备中
六、 make3.8.2的安装步骤:
tar -zxvf make3.8.2.tar.gz
在make-3.8.2目录下
./configure
make
make install (在root权限下操作,可以使用sudo make1 install 不会替换之前的版本的make 使用的时候 make1 XXX)
一般情况下不会出现错误,在/usr/local/bin中可得到新版本的make,复制到/usr/bin中