diff --git a/java/jdeps.go b/java/jdeps.go index 373433517..a52b86708 100644 --- a/java/jdeps.go +++ b/java/jdeps.go @@ -52,6 +52,11 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont return } + // Prevent including both prebuilts and matching source modules when one replaces the other. + if !android.IsModulePreferred(module) { + return + } + ideInfoProvider, ok := module.(android.IDEInfo) if !ok { return