llfbandit / record

Audio recorder from microphone to a given file path. No external dependencies, MediaRecorder is used for Android an AVAudioRecorder for iOS.
https://pub.dev/packages/record
243 stars 204 forks source link

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

Closed zhengguo07q closed 4 months ago

zhengguo07q commented 4 months ago

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

FAILURE: Build failed with an exception.

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 commented 4 months ago

https://github.com/llfbandit/record/issues/333

zhengguo07q commented 4 months ago

@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 commented 4 months ago

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 commented 4 months ago

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