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

Build failed in flutter 3.24 #76

Open
Mahdi-Panahi opened this issue Sep 7, 2024 · 6 comments
Open

Build failed in flutter 3.24 #76

Mahdi-Panahi opened this issue Sep 7, 2024 · 6 comments

Comments

@Mahdi-Panahi
Copy link

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':install_plugin:verifyReleaseResources'.

A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
Android resource linking failed
ERROR:C:***\install_plugin\intermediates\merged_res\release\values\values.xml:211: AAPT: error: resource android:attr/lStar not found.

@brandonLYQ00
Copy link

Same error occurred on flutter 3.24. Please fix

@brandyn
Copy link

brandyn commented Sep 14, 2024

I get a different error with 3.24. To keep it clean, I created a brand new, empty (default example app) flutter project, and then just added install_plugin to the pubspec. This results in the following build error:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':install_plugin'.

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

@camillobucciarelli
Copy link

The issue is related to namespace, to fix this they need to release PR #67

@khaled-0
Copy link

khaled-0 commented Oct 29, 2024

Workaround

android/app/build.gradle

 compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_17
    }

android/build.gradle

// .....
rootProject.buildDir = '../build'

// FIX for Flutter 3.24
subprojects {
    afterEvaluate {
        android {
            compileSdkVersion 34
        }
    }
}

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

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

subprojects {
    project.evaluationDependsOn(':app')
}

//.....

gradle.properties

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
kotlin.jvm.target.validation.mode = IGNORE

gradle-wrapper.properties

distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

settings.gradle

   id "com.android.application" version "8.3.2" apply false
   id "org.jetbrains.kotlin.android" version "2.0.20" apply false

@reynegton
Copy link

Workaround android/build.gradle

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'

// FIX for Flutter 3.24
subprojects {
    afterEvaluate {
        android {
            compileSdkVersion 34
        }
    }
}

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


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

subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

After that, the following error occurs:

Execution failed for task ':install_plugin:compileDebugKotlin'.

'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

@khaled-0
Copy link

khaled-0 commented Nov 1, 2024

Workaround android/build.gradle

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'

// FIX for Flutter 3.24
subprojects {
    afterEvaluate {
        android {
            compileSdkVersion 34
        }
    }
}

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


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

subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

After that, the following error occurs:

Execution failed for task ':install_plugin:compileDebugKotlin'.

'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

updated my comment to include full changes i did

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