diff --git a/android/apex.go b/android/apex.go index 81f8c867f..a014592ef 100644 --- a/android/apex.go +++ b/android/apex.go @@ -849,8 +849,12 @@ func CheckMinSdkVersion(m UpdatableModule, ctx ModuleContext, minSdkVersion ApiL if err := to.ShouldSupportSdkVersion(ctx, minSdkVersion); err != nil { toName := ctx.OtherModuleName(to) if ver, ok := minSdkVersionAllowlist[toName]; !ok || ver.GreaterThan(minSdkVersion) { - ctx.OtherModuleErrorf(to, "should support min_sdk_version(%v) for %q: %v. Dependency path: %s", - minSdkVersion, ctx.ModuleName(), err.Error(), ctx.GetPathString(false)) + ctx.OtherModuleErrorf(to, "should support min_sdk_version(%v) for %q: %v."+ + "\n\nDependency path: %s\n\n"+ + "Consider adding 'min_sdk_version: %q' to %q", + minSdkVersion, ctx.ModuleName(), err.Error(), + ctx.GetPathString(false), + minSdkVersion, ctx.ModuleName()) return false } } diff --git a/apex/apex.go b/apex/apex.go index 662bbbd0b..65260cc00 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -2246,8 +2246,10 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { if to.AvailableFor(apexName) || baselineApexAvailable(apexName, toName) { return true } - ctx.ModuleErrorf("%q requires %q that doesn't list the APEX under 'apex_available'. Dependency path:%s", - fromName, toName, ctx.GetPathString(true)) + ctx.ModuleErrorf("%q requires %q that doesn't list the APEX under 'apex_available'."+ + "\n\nDependency path:%s\n\n"+ + "Consider adding %q to 'apex_available' property of %q", + fromName, toName, ctx.GetPathString(true), apexName, toName) // Visit this module's dependencies to check and report any issues with their availability. return true }) diff --git a/apex/apex_test.go b/apex/apex_test.go index 3f5604741..c90b92806 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -5184,7 +5184,7 @@ func TestApexAvailable_DirectDep(t *testing.T) { func TestApexAvailable_IndirectDep(t *testing.T) { // libbbaz is an indirect dep - testApexError(t, `requires "libbaz" that doesn't list the APEX under 'apex_available'. Dependency path: + testApexError(t, `requires "libbaz" that doesn't list the APEX under 'apex_available'.\n\nDependency path: .*via tag apex\.dependencyTag.*name:sharedLib.* .*-> libfoo.*link:shared.* .*via tag cc\.libraryDependencyTag.*Kind:sharedLibraryDependency.*