diff options
Diffstat (limited to 'java/app.go')
| -rwxr-xr-x | java/app.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/java/app.go b/java/app.go index 0c56d81fc..32c69a173 100755 --- a/java/app.go +++ b/java/app.go @@ -777,6 +777,9 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) { a.onDeviceDir = android.InstallPathToOnDevicePath(ctx, a.installDir) a.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx) + if a.usesLibrary.shouldDisableDexpreopt { + a.dexpreopter.disableDexpreopt() + } var noticeAssetPath android.WritablePath if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") { @@ -1547,6 +1550,9 @@ type usesLibrary struct { // Whether to enforce verify_uses_library check. enforce bool + + // Whether dexpreopt should be disabled + shouldDisableDexpreopt bool } func (u *usesLibrary) addLib(lib string, optional bool) { @@ -1628,6 +1634,15 @@ func (u *usesLibrary) classLoaderContextForUsesLibDeps(ctx android.ModuleContext } } + // Skip java_sdk_library dependencies that provide stubs, but not an implementation. + // This will be restricted to optional_uses_libs + if sdklib, ok := m.(SdkLibraryDependency); ok { + if tag == usesLibOptTag && sdklib.DexJarBuildPath(ctx).PathOrNil() == nil { + u.shouldDisableDexpreopt = true + return + } + } + if lib, ok := m.(UsesLibraryDependency); ok { libName := dep if ulib, ok := m.(ProvidesUsesLib); ok && ulib.ProvidesUsesLib() != nil { |