我需要帮助AOSP中新的Soong应用程序构建系统使用的Android.bp脚本。
我无法使用新的构建脚本Android.bp为Android Oreo构建简单的HelloWorld应用程序 我的剧本:
android_app {
name: "AmpTest",
certificate: "platform",
manifest: "app/src/main/AndroidManifest.xml",
srcs: [
"app/src/main/java/**/*.java"
],
android_resource_dirs: [
"app/src/main/res"
],
enabled: true
}
但我看到错误:
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -b out/soong -d
out/soong/build.ninja.d -o out/soong/build.ninja Android.bp
error: packages/apps/AmpTest/Android.bp:4:1: "AmpTest" depends on undefined module "core-libart"
error: packages/apps/AmpTest/Android.bp:4:1: "AmpTest" depends on undefined module "core-oj"
error: packages/apps/AmpTest/Android.bp:4:1: "AmpTest" depends on undefined module "core-libart"
error: packages/apps/AmpTest/Android.bp:4:1: "AmpTest" depends on undefined module "ext"
error: packages/apps/AmpTest/Android.bp:4:1: "AmpTest" depends on undefined module "framework"
error: packages/apps/AmpTest/Android.bp:4:1: "AmpTest" depends on undefined module "okhttp"
error: packages/apps/AmpTest/Android.bp:4:1: "AmpTest" depends on undefined module "framework-res"
ninja: build stopped: subcommand failed.
我尝试添加 libs:[] static_libs:[]
但没有运气
问题是:如何使用Android.bp创建APK?
供参考:
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.1.0
TARGET_PRODUCT=aosp_x86_64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86_64
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.10.0-42-generic-x86_64-with-LinuxMint-18.3-sylvia
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=OPM1.171019.011
OUT_DIR=out
答案 0 :(得分:1)
看起来Soong需要知道它的模块依赖性。
也就是说,如果那些其他模块都在 mk 文件中,那么Soong就不会对它们有所了解,而目前似乎没有办法暴露他们。
希望this links澄清了答案的来源。
目前最好坚持使用 mk 文件。