欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

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

程序员文章站 2022-03-03 22:22:02
Android.bp编译提示ninja: error: unknown target 'MODULES-IN-xxx’终极指南前言   当我们通过Android.bp编译脚本构建App或者bin执行文件时,可能会莫名的提示ninja: error: unknown target 'MODULES-IN-paxdroid-external-AndroidBp’的错误,那么怎么解决呢?好吗,让......

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



前言

   当我们通过Android.bp编译脚本构建App或者bin执行文件时,可能会莫名的提示ninja: error: unknown target 'MODULES-IN-xxxxroid-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-xxxxroid-external-AndroidBp'
15:33:36 ninja failed with: exit status 1

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


### 1.2 修改

这个比较容易解决,一般是在你的Android源码编译根目录,修改顶层的Android.bp然后将你的文件工程路径添加上去,譬如我这里添加的是xxxxroid/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/*",
    "xxxxroid/external/systool",
    "xxxxroid/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’终极指南征程,此时的你对于解决这个问题已经是了然于心了,畅通无阻,来去无踪影了。此时的你可以一剑走天下了,为师的必杀器已经倾囊相授了。各位江湖见。



写在最后

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

本文地址:https://blog.csdn.net/tkwxty/article/details/105142182