是否可以使用Android.bp构建Android应用程序?
我尝试使用以下命令从Android.MK文件生成Android.bp文件
androidmk Android.mk > Android.bp
生成的Android.bp文件就像,
// ANDROIDMK TRANSLATION ERROR: unsupported assignment to LOCAL_RESOURCE_DIR
// LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res frameworks/support/v7/appcompat/res frameworks/support/design/res
TARGET_ABI = ["x86_64"]
android_app {
srcs: ["src/**/*.java"],
name: "ResourceDemo",
static_libs: ["android-support-v4"] + ["android-support-v7-appcompat"],
certificate: "platform",
// ANDROIDMK TRANSLATION ERROR: unsupported assignment to LOCAL_PRIVILEGED_MODULE
// LOCAL_PRIVILEGED_MODULE := true
// ANDROIDMK TRANSLATION ERROR: unsupported assignment to LOCAL_USE_AAPT2
// LOCAL_USE_AAPT2 := true
// ANDROIDMK TRANSLATION ERROR: unsupported assignment to LOCAL_DEX_PREOPT
// LOCAL_DEX_PREOPT := true
// ANDROIDMK TRANSLATION ERROR: unsupported assignment to LOCAL_PROGUARD_ENABLED
// LOCAL_PROGUARD_ENABLED := nosystem
// ANDROIDMK TRANSLATION ERROR: unsupported assignment to LOCAL_PROGUARD_FLAG_FILES
// LOCAL_PROGUARD_FLAG_FILES := proguard.flags
aaptflags: ["--auto-add-overlay"],
product_variables: {
pdk: {
enabled: false,
},
},
}
运行make build命令后,出现以下错误
[1/1] out/soong/.bootstrap/bin/minibp out/soong/.bootstrap/build.ninja
[2/2] out/soong/.bootstrap/bin/minibp out/soong/.bootstrap/build.ninja
[1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
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/ResourceDemo/Android.bp:1:1: "ResourceDemo" depends on undefined module "core-libart"
error: packages/apps/ResourceDemo/Android.bp:1:1: "ResourceDemo" depends on undefined module "core-oj"
error: packages/apps/ResourceDemo/Android.bp:1:1: "ResourceDemo" depends on undefined module "core-libart"
error: packages/apps/ResourceDemo/Android.bp:1:1: "ResourceDemo" depends on undefined module "ext"
error: packages/apps/ResourceDemo/Android.bp:1:1: "ResourceDemo" depends on undefined module "framework"
error: packages/apps/ResourceDemo/Android.bp:1:1: "ResourceDemo" depends on undefined module "okhttp"
error: packages/apps/ResourceDemo/Android.bp:1:1: "ResourceDemo" depends on undefined module "android-support-v4"
error: packages/apps/ResourceDemo/Android.bp:1:1: "ResourceDemo" depends on undefined module "android-support-v7-appcompat"
error: packages/apps/ResourceDemo/Android.bp:1:1: "ResourceDemo" depends on undefined module "framework-res"
ninja: build stopped: subcommand failed.
09:21:36 soong failed with: exit status 1
#### failed to build some targets (3 seconds) ####
帮我构建使用Android.bp
答案 0 :(得分:0)
有可能,但是有limitations,您需要使用AOSP母版的最新提示。例如,这是一个基于Android.bp文件构建的基于Kotlin的特权应用程序: https://github.com/jzoran/kotlin-privapp/blob/master/Android.bp
最近已将多个平台组件转换为Android.bp,但是取决于您应用程序的复杂性,取决于它所依赖的组件,它可能还是可能无法实现。
也许尚不支持某些Android.mk语句,并且关于Soong支持的内容,androidmk可能尚未完全更新。如果遇到翻译错误,请查看out / {TARGET} /soong/docs/soong_build.html生成的Soong构建文档。您可能会在此处找到等效的Blueprint声明。