[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The shrinker may have failed to optimize the Java bytecode. #356

Closed
zhengguo07q opened this issue Jun 27, 2024 · 4 comments
Closed

The shrinker may have failed to optimize the Java bytecode. #356

zhengguo07q opened this issue Jun 27, 2024 · 4 comments

Comments

@zhengguo07q
Copy link

@llfbandit
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mergeExtDexDebug'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform play-services-location-21.2.0.aar (com.google.android.gms:play-services-location:21.2.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: C:\Users\85938.gradle\caches\transforms-3\50ad0727ed433953c31c65778dfc029b\transformed\jetified-play-services-location-21.2.0-runtime.jar.
> Error while dexing.
Failed to transform kotlin-stdlib-1.9.23.jar (org.jetbrains.kotlin:kotlin-stdlib:1.9.23) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.jvm.environment=standard-jvm, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
> Execution failed for DexingWithClasspathTransform: C:\Users\85938.gradle\caches\transforms-3\7eec90a023c77b0d6a4fa9c734f946bf\transformed\jetified-kotlin-stdlib-1.9.23.jar.
> Error while dexing.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 1m 57s

no , I attempted to upgrade to compileSdk = 34 and applied id "com.android.application" version "7.4.2" with apply false, but encountered issues nonetheless.

@nicklbaert
Copy link

#333

@zhengguo07q
Copy link
Author

@nicklbaert After upgrading to AGP 8.0, it prompts that each Android package requires a Namespace. How should I handle external packages that I reference which do not have this tag?

@llfbandit
Copy link
Owner

There's no need to upgrade to AGP 8.x

You can set you AGP plugin to 7.4.2 and AGP to 7.6.4. Those 2 are latest versions I believe.

If you still have issues with other plugins in your project you could also try this (untested):

// Top-level build.gradle file
allprojects {
    ...
    // Add this to populate namespace to other packages. 
    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                project.android {
                    if (namespace == null) {
                        namespace project.group
                    }
                }
            }
        }
    }
}

@zhengguo07q
Copy link
Author

I was using AGP 7, setting the minSdkVersion to 24 resolved the issue. tks

@llfbandit llfbandit closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants