From 84f1b808664b9f764de6e97ba312911d3834e2a1 Mon Sep 17 00:00:00 2001 From: Jaewoong Jung Date: Fri, 4 Dec 2020 11:51:29 -0800 Subject: No matching variant android_app_import fix This fixes a bug where android_app_import or android_test_import without a matching variant or a default apk property value breaks the build. Test: app_test.go Fixes: 152343232 Change-Id: I8215aa1a6dad74b503eaa1169a64f8c30dda287c --- java/app.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'java/app.go') diff --git a/java/app.go b/java/app.go index 4bf9d33ea..e6d9550ec 100755 --- a/java/app.go +++ b/java/app.go @@ -1400,6 +1400,13 @@ func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) { archProps := reflect.ValueOf(a.archVariants).Elem().FieldByName("Arch") archType := ctx.Config().AndroidFirstDeviceTarget.Arch.ArchType MergePropertiesFromVariant(ctx, &a.properties, archProps, archType.Name) + + if String(a.properties.Apk) == "" { + // Disable this module since the apk property is still empty after processing all matching + // variants. This likely means there is no matching variant, and the default variant doesn't + // have an apk property value either. + a.Disable() + } } func MergePropertiesFromVariant(ctx android.EarlyModuleContext, -- cgit v1.2.3-59-g8ed1b