diff --git a/java/droidstubs.go b/java/droidstubs.go index 8a521aabb..d577b22cc 100644 --- a/java/droidstubs.go +++ b/java/droidstubs.go @@ -535,6 +535,10 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi // b/223382732 FlagWithArg("--hide ", "ChangedDefault") + // Force metalava to ignore classes on the classpath when an API file contains missing classes. + // See b/285140653 for more information. + cmd.FlagWithArg("--api-class-resolution ", "api") + return cmd } diff --git a/java/java.go b/java/java.go index aa9f936d0..5bc378b0c 100644 --- a/java/java.go +++ b/java/java.go @@ -1728,6 +1728,10 @@ func metalavaStubCmd(ctx android.ModuleContext, rule *android.RuleBuilder, FlagWithArg("--hide ", "InvalidNullabilityOverride"). FlagWithArg("--hide ", "ChangedDefault") + // Force metalava to ignore classes on the classpath when an API file contains missing classes. + // See b/285140653 for more information. + cmd.FlagWithArg("--api-class-resolution ", "api") + return cmd }