westman
westman

Reputation: 61

Build an application into Android system with Android.bp instead of Android.mk

I need help with Android.bp script used by the new Soong application build system in AOSP.

I can't build simple HelloWorld application for Android Oreo, with new build scripts Android.bp my script:

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
}

but i see errors:

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.

i tried add libs: [] static_libs: []

but no luck

Question is: how to create APK with Android.bp?

FYI:

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

Upvotes: 2

Views: 9327

Answers (1)

Olaia
Olaia

Reputation: 2210

It looks like Soong requires knowledge of it's modules dependencies.

That is, if those other modules are in mk files, Soong will not have knowledge of them, and for the moment there doesn't seem to be a way to expose them.

Hope this links clarifies the answer's source.

Looks like it's better to stick to mk files for the moment.

Upvotes: 2

Related Questions