diff --git a/apex/apex_test.go b/apex/apex_test.go index 54b0ccc1c..3b3cafd00 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -4979,6 +4979,12 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { // find the dex boot jar in it. We either need to disable the source libfoo // or make the prebuilt libfoo preferred. testDexpreoptWithApexes(t, bp, "module libfoo does not provide a dex boot jar", preparer, fragment) + // dexbootjar check is skipped if AllowMissingDependencies is true + preparerAllowMissingDeps := android.GroupFixturePreparers( + preparer, + android.PrepareForTestWithAllowMissingDependencies, + ) + testDexpreoptWithApexes(t, bp, "", preparerAllowMissingDeps, fragment) }) t.Run("prebuilt library preferred with source", func(t *testing.T) { diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 1019b4c85..946092cdb 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -500,7 +500,11 @@ func copyBootJarsToPredefinedLocations(ctx android.ModuleContext, srcBootDexJars dst := dstBootJarsByModule[name] if src == nil { - ctx.ModuleErrorf("module %s does not provide a dex boot jar", name) + if !ctx.Config().AllowMissingDependencies() { + ctx.ModuleErrorf("module %s does not provide a dex boot jar", name) + } else { + ctx.AddMissingDependencies([]string{name}) + } } else if dst == nil { ctx.ModuleErrorf("module %s is not part of the boot configuration", name) } else {