diff --git a/java/java.go b/java/java.go index 258ebba0c..46344c842 100644 --- a/java/java.go +++ b/java/java.go @@ -1864,10 +1864,12 @@ func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) { if ctx.Arch().ArchType == android.Common { j.deps(ctx) } - if ctx.Arch().ArchType != android.Common { - // These dependencies ensure the host installation rules will install the jar file and - // the jni libraries when the wrapper is installed. + // These dependencies ensure the installation rules will install the jar file when the + // wrapper is installed, and the jni libraries on host when the wrapper is installed. + if ctx.Arch().ArchType != android.Common && ctx.Os().Class == android.Host { ctx.AddVariationDependencies(nil, jniInstallTag, j.binaryProperties.Jni_libs...) + } + if ctx.Arch().ArchType != android.Common { ctx.AddVariationDependencies( []blueprint.Variation{{Mutator: "arch", Variation: android.CommonArch.String()}}, binaryInstallTag, ctx.ModuleName())