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

on android latest version getting compile error #753

Open
shaikhnafees99 opened this issue Nov 13, 2024 · 4 comments
Open

on android latest version getting compile error #753

shaikhnafees99 opened this issue Nov 13, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@shaikhnafees99
Copy link

What went wrong:

Execution failed for task ':app:checkDebugAarMetadata'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction

An issue was found when checking AAR metadata:

   1.  Dependency ':qr_code_scanner' requires core library desugaring to be enabled

       for :app.
@shaikhnafees99 shaikhnafees99 added the bug Something isn't working label Nov 13, 2024
@frankdevelopero
Copy link

I have same the problem:

* What went wrong:
A problem occurred configuring project ':qr_code_scanner'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
   > Namespace not specified. Specify a namespace in the module's build file: /Users/frank/.pub-cache/hosted/pub.dev/qr_code_scanner-1.0.1/android/build.gradle. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

     If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.

settings.gradle:

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "8.7.0" apply false
    id "org.jetbrains.kotlin.android" version "2.0.21" apply false
    id "com.google.gms.google-services" version "4.4.2" apply false
}

Did anyone find a solution?

@dieptv1999
Copy link

add

// for qr_code_scanner
    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                project.android {
                    if (namespace == null) {
                        namespace project.group
                    }
                }
            }
        }
    }

in scope allprojects {}

@zh-hl
Copy link

zh-hl commented Nov 28, 2024

I found an easier way to fix.

The issue was caused by Android Studio Ladybug having bundled a version of Java that isn't fully backward compatible with Flutter's plugin ecosystem (source).

Since I was using Java 11 before (installed separately using homebrew), all I need to do was to tell Flutter to use that java version, instead of the JRE bundled inside Android Studio. To do that I just have to execute this command:

$ flutter config --jdk-dir /path/to/my/java

And my flutter project was compiling correctly again without any change to the project itself.

If you don't have any other Java on your machine, see the source above to install it. They say Java 17 is the last working version.

@wizmea
Copy link

wizmea commented Dec 23, 2024

Alternative here https://github.com/wizmea/qr_code_scanner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants