SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(…)?
今天下午刚解决完上一个问题后,下一个问题在编译了一个半小时后又冒了出来
wildcard(out/target/product/generic_x86_64/clean_steps.mk) was changed, regenerating...
[ 99% 11909/11910] Create system-qemu.img now
FAILED: out/target/product/generic_x86_64/system-qemu.img
/bin/bash -c "(export SGDISK=out/host/linux-x86/bin/sgdisk SIMG2IMG=out/host/linux-x86/bin/simg2img; device/generic/goldfish/tools/mk_combined_img.py -i out/target/product/generic_x86_64/system-qemu-config.txt -o out/target/product/generic_x86_64/system-qemu.img)"
File "/home/kali/aosp/device/generic/goldfish/tools/mk_combined_img.py", line 53
print "Invalid partition number: %d, range [1..%d]" % \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
[100% 11910/11910] build check-all-partition-sizes
The sum of sizes of [system vendor] is within BOARD_SUPER_PARTITION_SIZE:
1468014592+119820288 == 1587834880 <= 3229614080 == 3229614080
The sum of sizes of [system vendor] is within BOARD_EMULATOR_DYNAMIC_PARTITIONS_SIZE:
1468014592+119820288 == 1587834880 <= 3221225472 == 3221225472
The sum of sizes of [emulator_dynamic_partitions] is within BOARD_SUPER_PARTITION_SIZE:
3221225472 == 3221225472 <= 3229614080 == 3229614080
05:53:59 ninja failed with: exit status 1
#### failed to build some targets (08:34 (mm:ss)) ####
你的错误的具体位置可能不一样,但核心问题都是SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
,同样在网上查了一下,发现是python版本的问题
这个应该用python2,而不是python3
解决方案:
如果操作系统没有安装python2,那就安装python2(不过linux系统一般会预装python2)
然后修改报错对应的python文件:
sudo vim ~/aosp/device/generic/goldfish/tools/mk_combined_img.py
在图中所示位置:
把第一行的python改成python2即可
结果:
终于编译成功了