Android.bp编译提示ninja: error: unknown target 'MODULES-IN-xxx'终极指南

Neoma ·
更新时间:2024-11-13
· 916 次阅读

Android.bp编译提示ninja: error: unknown target 'MODULES-IN-xxx’终极指南

前言

   当我们通过Android.bp编译脚本构建App或者bin执行文件时,可能会莫名的提示ninja: error: unknown target 'MODULES-IN-paxdroid-external-AndroidBp’的错误,那么怎么解决呢?好吗,让我带领你一期解决。

注意:这个问题常见于Android 8上面



一.解决办法
### 1.1 错误提示 先看一下错误提示: build/core/Makefile:1902: warning: overriding commands for target `out/target/product/sl8541e_1h10_go/prodnv.img' build/core/Makefile:34: warning: ignoring old commands for target `out/target/product/sl8541e_1h10_go/prodnv.img' vendor/sprd/build/tasks/sprdbuildota.mk:98: warning: overriding commands for target `out/target/product/sl8541e_1h10_go/sl8541e_1h10_gofu_osll-ota-6.zip' build/core/Makefile:2821: warning: ignoring old commands for target `out/target/product/sl8541e_1h10_go/sl8541e_1h10_gofu_osll-ota-6.zip' ninja: error: unknown target 'MODULES-IN-paxdroid-external-AndroidBp' 15:33:36 ninja failed with: exit status 1

在这里插入图片描述


### 1.2 修改

这个比较容易解决,一般是在你的Android源码编译根目录,修改顶层的Android.bp然后将你的文件工程路径添加上去,譬如我这里添加的是paxdroid/external/AndroidBp.

subname = "Android.bp" build = [ "build/blueprint/Blueprints", ] subdirs = [ "build/soong", ] optional_subdirs = [ "art", "bionic", "bootable/recovery", "build/kati", "build/tools/*", "dalvik", "development/*", "device/*/*", "external/*", "frameworks/*", "frameworks/compile/*", "frameworks/hardware/interfaces", "frameworks/opt/net/wifi", "hardware/*", "libcore", "libnativehelper", "packages/apps/*", "paxdroid/external/systool", "paxdroid/external/AndroidBp", "prebuilts/clang/host/linux-x86", "prebuilts/ndk", "prebuilts/sdk", "system/*", "system/hardware/interfaces", "system/tools/*", "test/vts", "test/vts-testcase/*", "vendor/*/*", "vendor/*/*/*" ]

编译成功:

在这里插入图片描述

结语

修行至此,恭喜读者你已经开启了Android.bp编译提示ninja: error: unknown target 'MODULES-IN-xxx’终极指南征程,此时的你对于解决这个问题已经是了然于心了,畅通无阻,来去无踪影了。此时的你可以一剑走天下了,为师的必杀器已经倾囊相授了。各位江湖见。



写在最后

   各位读者看官朋友们,Android.bp编译提示ninja: error: unknown target 'MODULES-IN-xxx’终极指南已经全部完毕,希望能吸引你,激活发你的学习欲望和斗志。在最后麻烦读者朋友们如果本篇对你有帮助,关注和点赞一下,当然如果有错误和不足的地方也可以拍砖。


作者:进阶的凯子



unknown error target Android

需要 登录 后方可回复, 如果你还没有账号请 注册新账号