[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. #353

Closed
hussainint opened this issue Jun 26, 2024 · 9 comments
Closed

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

hussainint opened this issue Jun 26, 2024 · 9 comments

Comments

@hussainint
Copy link

Package version
record: ^5.1.2

Environment

  • OS: Android

Describe the bug
On adding the plugin to dependency and adding the required permissions, i am unable to run the app.

[✓] Flutter (Channel stable, 3.22.2, on macOS 14.1 23B2073 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.89.1)
[✓] Connected device (4 available)
[✓] Network resources

Additional context

ERROR:/Users/hussainint/Desktop/fluttercode/doct/build/record_android/intermediates/runtime_library_classes_jar/debug/classes.jar: D8: com.android.tools.r8.internal.Hc: Sealed classes are not supported as program classes

FAILURE: Build failed with an exception.

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

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform classes.jar (project :record_android) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, com.android.build.api.attributes.AgpVersionAttr=7.3.0, com.android.build.api.attributes.BuildTypeAttr=debug, com.android.build.gradle.internal.attributes.VariantAttr=debug, 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=android, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=androidJvm}.
> Execution failed for DexingWithClasspathTransform: /Users/hussainint/Desktop/fluttercode/doct/build/record_android/intermediates/runtime_library_classes_jar/debug/classes.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 2s
Running Gradle task 'assembleDebug'... 3.2s

┌─ Flutter Fix ──────────────────────────────────────────────────────────────┐
│ [!] The shrinker may have failed to optimize the Java bytecode. │
│ To disable the shrinker, pass the --no-shrink flag to this command. │
│ To learn more, see: https://developer.android.com/studio/build/shrink-code
└────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1

@zhengguo07q
Copy link

I encountered the same error and upgrading Gradle, as suggested, led to numerous other library issues.
https://github.com/llfbandit/record/blob/master/record_android/README.md

@sujithsureshkumar
Copy link

I am also facing same issue, could any please tell me the package version don't having this issue.

@no-chili
Copy link

same issue

@llfbandit
Copy link
Owner

I reverted to Java 8.
Can someone can confirm the issue is gone by applying dependency on record_android from git (master branch)?

@hussainint
Copy link
Author

@llfbandit tried applying record_android from git. This works fine.

@hussainint
Copy link
Author

@llfbandit
Copy link
Owner

@zhengguo07q can you confirm too before publishing new version?

@zhengguo07q
Copy link
zhengguo07q commented Jun 27, 2024

@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.

@fodil-a
Copy link
fodil-a commented Jun 29, 2024

@llfbandit tried applying record_android from git. This works fine.

works with master version @llfbandit

when do you think that you can release a new version ?

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

6 participants