juliuscanute / qr_code_scanner

QR Code Scanner for Flutter
BSD 2-Clause "Simplified" License
1.01k stars 802 forks source link

[BUG] After updating to Flutter 3.24.3, an error occurred. #744

Open vantuyenitc opened 2 months ago

vantuyenitc commented 2 months ago

Describe the bug I updated Flutter to version 3.24.3, and encountered the following error.

Flutter information Always provide the output of flutter doctor -v as it is needed in order to know on which Flutter versions the bug exists in. flutter --version Flutter 3.24.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision 2663184aa7 (4 days ago) • 2024-09-11 16:27:48 -0500 Engine • revision 36335019a8 Tools • Dart 3.5.3 • DevTools 2.37.3 Device (please complete the following information):

Screenshots If applicable, add screenshots to help explain your problem. image

Additional context

lex-nel commented 1 month ago

+1

Alex-esc1 commented 1 month ago

+1

pedrovarini commented 1 month ago

+1

pedrovarini commented 1 month ago

+1

goz1984 commented 1 month ago

the same here.. any workaround?

ryu-akaike commented 1 month ago

+1

vshvedov commented 1 month ago

Same

d-khomenko commented 1 month ago

+1

kiaxseventh commented 1 month ago

+1

vshvedov commented 1 month ago
qr_code_scanner:
  git:
    url: https://github.com/asmrtfm/qr_code_scanner
    ref: patch-1
    version: ^1.0.0
apoorvpandey commented 1 month ago

Thanks @vshvedov works!

iftakher36 commented 1 month ago

Thanks @vshvedov works fine

mahmoudsfares commented 1 month ago

instead of forking each repo that's causing the problem after adding the namespace, add this in your project's build.gradle in a spearate subprojects block:

subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"

    afterEvaluate {
        if (it.hasProperty('android')) {
            // Check whether the android.namespace property is set.
            // If not, read the package name from the app's manifest file and set it as the namespace.
            if (it.android.namespace == null) {
                def manifest = new XmlSlurper().parse(file(it.android.sourceSets.main.manifest.srcFile))
                def packageName = manifest.@package.text()
                println("Setting ${packageName} as android namespace")
                android.namespace = packageName
            }

            // Set both the sourceCompatibility and targetCompatibility to Java 17,
            // ensuring that both Java and Kotlin code are compiled with the correct target JVM version.
            def javaVersion = JavaVersion.VERSION_17
            android {
                def androidApiVersion = 35
                compileSdkVersion androidApiVersion
                defaultConfig {
                    targetSdkVersion androidApiVersion
                }
                compileOptions {
                    sourceCompatibility javaVersion
                    targetCompatibility javaVersion
                }
            }

            // Ensure that all subprojects in the build follow the same Java version
            // and build directory configurations. Evaluate settings after all configurations
            // have been applied to make sure everything is in sync.
            tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
                kotlinOptions {
                    jvmTarget = javaVersion.toString()
                }
            }
        }
    }
}

this will add the namespace to the gradles automatically while the app is being built

hadiarshad6767 commented 3 weeks ago

Same issue

avinashk369 commented 3 weeks ago
subprojects {
    afterEvaluate { project ->
        if (project.hasProperty('android')) {
            project.android {
                if (namespace == null) {
                    namespace project.group
                }
            }
        }
    }
}

add this block inside your module level build.gradle file

MostafaEsmail007 commented 1 week ago

add in app/bulid.gradle

android {
        compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
        coreLibraryDesugaringEnabled true
    }
}

dependencies {
    implementation 'androidx.window:window:1.3.0'
    implementation 'androidx.window:window-java:1.3.0'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.2'
}

and in gradle.properties

kotlin.jvm.target.validation.mode = IGNORE