admin管理员组

文章数量:1356363

I'm almost done with my project but since I started it I had this error in the android/build.gradle I tried making a new file but didn't work the same error always appears I'm scared it can affect my final apk

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

    rootProject.buildDir = "../build"
    subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
    project.evaluationDependsOn(":app")
    }

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

The supplied phased action failed with an exception. A problem occurred configuring project ':flutter_keyboard_visibility'. 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 for information about setting the namespace.

I'm almost done with my project but since I started it I had this error in the android/build.gradle I tried making a new file but didn't work the same error always appears I'm scared it can affect my final apk

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

    rootProject.buildDir = "../build"
    subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
    project.evaluationDependsOn(":app")
    }

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

The supplied phased action failed with an exception. A problem occurred configuring project ':flutter_keyboard_visibility'. 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/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

Share Improve this question edited Mar 31 at 2:16 Jaspalsinh Gohil 7281 gold badge9 silver badges25 bronze badges asked Mar 28 at 2:38 Sami HamzaSami Hamza 13 bronze badges 4
  • Can you provide the error message? – AaronCreor Commented Mar 28 at 3:06
  • The supplied phased action failed with an exception. A problem occurred configuring project ':flutter_keyboard_visibility'. 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 d.android/r/tools/upgrade-assistant/set-namespace for information about setting the namespace. – Sami Hamza Commented Mar 28 at 5:52
  • Are You using latest version of flutter_keyboard_visibility try using latest version – Jaspalsinh Gohil Commented Mar 28 at 8:46
  • Iam using the latest version 6.0.0 – Sami Hamza Commented Apr 1 at 3:57
Add a comment  | 

1 Answer 1

Reset to default 0

You have to go to the Flutter Plugins Folder then navigate to the package name then update the namespace there for example

External Libraries -> Flutter Plugins -> flutter_keyboard_visiblity -> android -> build.gradle

there update the android block like this:

android {
    // Conditional for compatibility with AGP <4.2.
    if (project.android.hasProperty("namespace")) {
        namespace 'com.jrai.flutter_keyboard_visibility'
    }

    compileSdkVersion 31

    defaultConfig {
        minSdkVersion 16
    }

    lint {
        disable 'InvalidPackage'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

then run pub get and this should solve your namespace issue

本文标签: androidflutter buildgradle exceptionStack Overflow