同步完源码,就可以继续编译了。(以后操作都在repo init的目录下,即media/leon/downloads/android/android-rom/cm13)
$ source build/envsetup.sh
$ lunch
选择需要编译的版本,发现没有自己要编译的nubia nx531j Z11版本。google了下,发现添加一个脚本到device/nubia/nx531j/下面
$ vim ./device/nubia/nx531j/vendorsetup.sh
将下面的代码添加进去
add_lunch_combo cm_nx531j-userdebug
这里的命名规则我不太明白,在当前目录下看了眼cm.mk,看到如下内容
PRODUCT_NAME := cm_nx531j
由于之前失败过一次,索性按照cm.mk中的名字来命名了。
重新执行下
$ source build/envsetup.sh
$ lunch
You're building on Linux
You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm64-eng 4. aosp_mips-eng 7. cm_nx531j-userdebug 10. mini_emulator_mips-userdebug
2. aosp_arm-eng 5. aosp_x86_64-eng 8. m_e_arm-userdebug 11. mini_emulator_x86_64-userdebug
3. aosp_mips64-eng 6. aosp_x86-eng 9. mini_emulator_arm64-userdebug 12. mini_emulator_x86-userdebug
Which would you like? [aosp_arm-eng] 7
成功添加
下面继续编译
make -j8 (cpu核心数*2)
报错了,日志显示没有安装mvn,我用的是idea内置的maven插件,所以再去安装个maven
$ sudo apt-get install maven
默认就是安装maven3,maven2安装会报错。
$ make clean
$ make -j8
继续编译
又报错了,mvn拉取一个apk的时候显示timeout,难道是gfw的原因,google真是个好宝贝,有个网友和我碰到一样的错误:地址 错误信息如下:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:get (default-cli) on project standalone-pom: Couldn't download artifact: Could not transfer artifact org.cyanogenmod:gello:apk:40 from/to central (https://maven.cyanogenmod.org/artifactory/gello_prebuilds): TransferFailedException
[ERROR] org.cyanogenmod:gello:apk:40
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false),
[ERROR] central (https://maven.cyanogenmod.org/artifactory/gello_prebuilds, releases=true, snapshots=true): ClientProtocolException: The server failed to respond with a valid HTTP response
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
下面要给maven设置代理
$ vim /etc/maven/setting.xml
#这里需要注意节点的问题
<settings>
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>127.0.0.1</host>
<port>1080</port>
</proxy>
</proxies>
</settings>
给maven设置代理之后并没有解决问题,只有设置vpn了,连接vpn之后,没有再出现相同的错误
PS:
安装好proxychains之后,可以通过代码,来指定shell的全局代理
proxychains bash