基于ubuntu16.04多用户编译android N(android 7.1)系统提示ninja_wrapper错误问题

基于ubuntu16.04多用户编译android N(android 7.1)系统提示ninja_wrapper错误问题

 

Ubuntu 1604系统除了root,还有kandisundi两个用户,我先用kandi用户编译的,可编译通过,后面再用sundi的用户编译,出错信息如下:

[ 19% 12620/64631] Ensure Jack server isinstalled and started

FAILED: /bin/bash -c"(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jarprebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 2>&1 || (exit 0) ) &&(JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8-XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin updateserver prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 4.8.ALPHA 2>&1 ||exit 0 ) && (prebuilts/sdk/tools/jack-admin update jackprebuilts/sdk/tools/jacks/jack-2.28.RELEASE.jar 2.28.RELEASE || exit 47;prebuilts/sdk/tools/jack-admin update jackprebuilts/sdk/tools/jacks/jack-3.36.CANDIDATE.jar 3.36.CANDIDATE || exit 47;prebuilts/sdk/tools/jack-admin update jackprebuilts/sdk/tools/jacks/jack-4.7.BETA.jar 4.7.BETA || exit 47 )"

Writing client settingsin /home/sundi/.jack-settings

Installing jack serverin "/home/sundi/.jack-server"

 

Warning:

The JKS keystore uses a proprietary format.It is recommended to migrate to PKCS12 which is an industry standard formatusing "keytool -importkeystore -srckeystore /home/sundi/.jack-server/server.jks-destkeystore /home/sundi/.jack-server/server.jks -deststoretype pkcs12".

 

Warning:

The JKS keystore uses a proprietary format.It is recommended to migrate to PKCS12 which is an industry standard formatusing "keytool -importkeystore -srckeystore /home/sundi/.jack-server/client.jks-destkeystore /home/sundi/.jack-server/client.jks -deststoretype pkcs12".

Communication error with Jack server (77),try 'jack-diagnose' or see Jack server log

Failed to contact Jackserver: Problem reading /home/sundi/.jack-server/server.pem. Try'jack-diagnose'

Failed to contact Jackserver: Problem reading /home/sundi/.jack-server/server.pem. Try'jack-diagnose'

 

此问题是在于Android N新特性中,将同一个使用过的TCP端口将视为唯一,所以遇到这种情况下需要修改两处文件。具体步骤如下:

1.    修改用户根目录下的.jack-settings文件的两个端口

vi .jack-settings(注意:此处一定要用vi命令,改完后执行chmod600 .jack-settings;确保文件权限为-rw-------

2.    修改用户根目录下.jack-server目录下的config.properties文件的两个端口

但没有发现此文件,进入代码的prebuilts/sdk/tools目录下./jack-adminstart-server来生成config.properties文件,如果失败,以此尝试下面的操作

(1)  ./jack-admin stop-server

(2)  ./jack-admin kill-server

(3)  ./jack-admin uninstall-server

(4)  ./jack-admin install-server jack-launcher.jar jack-server-4.8.ALPHA.jar

(5)  ./jack-admin start-server

提示:程序会卡在此处,先等待两秒,让程序自动生成.jack-server/config.properties文件,然后执行Ctrl+C,此时就有config.properties文件了,修改此文件的端口号,需要与.jack-settings的端口相对应,而且不能和其他用户的一样。

 

重新编译还是提示错误,如下:

 

FAILED: /bin/bash -c "(mkdir -pout/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack.tmpjill.res) && (unzip -qo prebuilts/sdk/8/android.jar -dout/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack.tmpjill.res) && (findout/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack.tmpjill.res-iname \"*.class\" -delete ) && (JACK_VERSION=3.36.CANDIDATEout/host/linux-x86/bin/jack @build/core/jack-default.args --verbose error  -D jack.import.resource.policy=keep-first -Djack.import.type.policy=keep-first -D jack.android.min-api-level=1 --importprebuilts/sdk/8/android.jar --import-resourceout/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack.tmpjill.res--output-jack out/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack) && (rm -rfout/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack.tmpjill.res)"

mkdir: cannot createdirectory ‘/tmp/jack-Data.BU/jack-task-15702/’:Permission denied

提示在/tmp/jack-Data.BU下没有权限创建jack-task-15702,用ll命令查看权限

  rwx(Owner)r-x(Group)r-x(Other)  

1列表示文件的属性,这里为drwx------,这里有10格,第1格表示第一个小格是特殊表示格,表示目录或连结文件等等,d表示目录。后面依次表示文件owner、所在的groupother用户的权限,可读(r),可写(w),可执行(x),说明此目录只有owner(这里为kandi)rwx权限,其他人没有访问的权限。

2列表示文件个数。

3列表示表示该文件或目录的拥有者,这里为kandi

4列,表示所属的组(group)。每一个使用者都可以拥有一个以上的组,不过大部分的使用者应该都只属于一个组,只有当系统管理员希望给予某使用者特殊权限时,才可能会给他另一个组。这里也是kandi

 

从上面的信息可以看出,除了kandi,其他用户,比如我编译出错的sundi用户没有权限访问,所以编译出错了。用chmod 777 jack-Data.BU修改,重新编译OK。修改后权限

 

你可能感兴趣的:(Android开发环境搭建)