1. 程式人生 > >Android6.0編譯時out目錄下檔案無法自動生成問題解決方案

Android6.0編譯時out目錄下檔案無法自動生成問題解決方案

Android6.0編譯時需要使用openjdk7編譯,然後伺服器上還有別的專案需要使用openjdk6進行編譯,於是在編譯時就出現了一些問題

Installing recovery patch to system partition
Warning: could not find SYSTEM/build.prop in <built-in function zip>
using prebuilt recovery.img from BOOTABLE_IMAGES...
using prebuilt boot.img from BOOTABLE_IMAGES...
Traceback (most recent call last):
  File "./build/tools/releasetools/make_recovery_patch", line 53, in <module>
    main(sys.argv[1:])
  File "./build/tools/releasetools/make_recovery_patch", line 49, in main
    common.MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img)
  File "/Public/zhangruifang/R3/android/build/tools/releasetools/common.py", line 1398, in MakeRecoveryPatch
    _, _, patch = d.ComputePatch()
  File "/Public/zhangruifang/R3/android/build/tools/releasetools/common.py", line 1089, in ComputePatch
    p = Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/Public/zhangruifang/R3/android/build/tools/releasetools/common.py", line 83, in Run
    return subprocess.Popen(args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
make: *** [out/target/product/msm8909/system/bin/install-recovery.sh] 錯誤 1

#### make failed to build some targets (06:30 (mm:ss)) ####

首先遇到的第一個問題就是out目錄下build.prop檔案找不到,該檔案是在編譯時由make系統解析build/core/Makefile檔案自動生成的

當時根本沒往jdk版本問題那個方向考慮,因為在別的終端該專案可以編譯成功,所以就將編譯成功後的build.prop拷了過來,拷過來之後就會發現問題了,out目錄下又會有一個檔案找不到

Installing recovery patch to system partition
Warning: could not find SYSTEM/build.prop in <built-in function zip>
using prebuilt recovery.img from BOOTABLE_IMAGES...
using prebuilt boot.img from BOOTABLE_IMAGES...
Traceback (most recent call last):
  File "./build/tools/releasetools/make_recovery_patch", line 53, in <module>
    main(sys.argv[1:])
  File "./build/tools/releasetools/make_recovery_patch", line 49, in main
    common.MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img)
  File "/Public/zhangruifang/R3/android/build/tools/releasetools/common.py", line 1398, in MakeRecoveryPatch
    _, _, patch = d.ComputePatch()
  File "/Public/zhangruifang/R3/android/build/tools/releasetools/common.py", line 1089, in ComputePatch
    p = Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/Public/zhangruifang/R3/android/build/tools/releasetools/common.py", line 83, in Run
    return subprocess.Popen(args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
make: *** [out/target/product/msm8909/system/bin/install-recovery.sh] 錯誤 1

#### make failed to build some targets (06:30 (mm:ss)) #### 

又是out目錄下該生成的檔案沒有生成,然後就想直接把out目錄刪掉,從編譯成功的專案中拷過來,但最終是治標不治本,終於在昨天解決了這個問題


先在專案的Android目錄下執行版本切換命令. jdk7.sh  ,這個是切換版本的指令碼檔案

然後到根目錄下去執行source .profile命令,然後再到專案Android目錄下去編譯,ok問題解決