fluttergradleandroid-gradle-pluginbuild.gradleflutter-dependencies

Error in Namespace due to flutter_beacon package


I am trying to scan the ibeacon devices using flutter_beacon: latest package. However, whenever I try to add this package and simply do ```flutter run`` I am encountering this problem.

What I have tried so far:

error:

   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.

* Try:

> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option .. ```

Note: I'm open to using a different package

Github: issue id 1


Solution

  • if you are using VSCode open Explorer panel in the left side then open Dependencies search for flutter_beacon folder and open it

    enter image description here

    then go to android -> build.gradle you'll find it like

        compileSdkVersion 30
    
        defaultConfig {
            minSdkVersion 18
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
        lintOptions {
            disable 'InvalidPackage'
        }
    }
    

    edit it to this

    android {
        namespace "com.flutterbeacon" // add this line
        compileSdkVersion 30
    
        defaultConfig {
            minSdkVersion 18
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
        lintOptions {
            disable 'InvalidPackage'
        }
    }
    

    finally, build your project again