diff --git a/cc/cc.go b/cc/cc.go index f80c229cb..79fda1f02 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -3200,6 +3200,10 @@ func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string } } +func (c *Module) IsSdkVariant() bool { + return c.Properties.IsSdkVariant +} + func getCurrentNdkPrebuiltVersion(ctx DepsContext) string { if ctx.Config().PlatformSdkVersionInt() > config.NdkMaxPrebuiltVersionInt { return strconv.Itoa(config.NdkMaxPrebuiltVersionInt) diff --git a/cc/library.go b/cc/library.go index ba8b0f40d..6405e4b79 100644 --- a/cc/library.go +++ b/cc/library.go @@ -1575,7 +1575,8 @@ func VersionVariantAvailable(module interface { // (which is unnamed) and zero or more stubs variants. func VersionMutator(mctx android.BottomUpMutatorContext) { if library, ok := mctx.Module().(LinkableInterface); ok && VersionVariantAvailable(library) { - if library.CcLibrary() && library.BuildSharedVariant() && len(library.StubsVersions()) > 0 { + if library.CcLibrary() && library.BuildSharedVariant() && len(library.StubsVersions()) > 0 && + !library.IsSdkVariant() { versions := library.StubsVersions() normalizeVersions(mctx, versions) if mctx.Failed() { diff --git a/cc/linkable.go b/cc/linkable.go index de36f9017..66b1c3fea 100644 --- a/cc/linkable.go +++ b/cc/linkable.go @@ -56,6 +56,7 @@ type LinkableInterface interface { SdkVersion() string AlwaysSdk() bool + IsSdkVariant() bool ToolchainLibrary() bool NdkPrebuiltStl() bool diff --git a/rust/rust.go b/rust/rust.go index 6671dd34a..1272e1d8f 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -196,6 +196,10 @@ func (mod *Module) AlwaysSdk() bool { return false } +func (mod *Module) IsSdkVariant() bool { + return false +} + func (mod *Module) ToolchainLibrary() bool { return false }