hemanthrajv / flutter_compass

MIT License
102 stars 188 forks source link

Causes build failure for Android #117

Open karatekid430 opened 1 month ago

karatekid430 commented 1 month ago

Please add the required line in the android tag in the build.gradle file:

namespace "compass"

This solves

FAILURE: Build failed with an exception.

TheHasnatBD commented 1 month ago

yes, an error occurs

PlayCulture commented 1 month ago

We would also greatly appreciate this being resolved ❤️

karatekid430 commented 1 month ago

Looking at this, best we use the Android namespace name

namespace "com.hemanthraj.fluttercompass"

karatekid430 commented 1 month ago

https://github.com/hemanthrajv/flutter_compass/pull/116

Looks resolved. But I do not see a release.

IldySilva commented 1 month ago

@hemanthrajv pls

benneca commented 1 month ago

ditto, all builds using gradle 8 or later require the namespace to be set

AndRud commented 1 month ago

update it, please

Ricky2118 commented 1 month ago

thank you, this helped!

nukithelegend commented 4 weeks ago

When will this be released?

mithun-itspe commented 3 weeks ago

@xVemu please fix this

xVemu commented 3 weeks ago

@xVemu please fix this

I'm not owner of the repo

Rob-Biemans commented 3 weeks ago

@karatekid430 @mithun-itspe @IldySilva @nukithelegend @xVemu

You can also add the following to the build.gradle file located in /android/build.gradle;

// ADD: first line of the build.gradle file:
import groovy.xml.XmlSlurper

// after line: rootProject.buildDir = '../build'
subprojects { project ->
    afterEvaluate {
        if (project.plugins.hasPlugin('com.android.application') || project.plugins.hasPlugin('com.android.library')) {
            // fix AAPT: error: resource android:attr/lStar not found.
            project.android {
                compileSdkVersion 34
                buildToolsVersion "34.0.0"
            }

            if (!project.android.hasProperty('namespace') || project.android.namespace == null || project.android.namespace.isEmpty()) {
                def manifestFile = project.file("src/main/AndroidManifest.xml")
                if (manifestFile.exists()) {
                    def manifest = new XmlSlurper().parse(manifestFile)
                    def packageName = manifest.@package.text()
                    if (packageName) {
                        project.android.namespace = packageName
                        println "Setting namespace for ${project.name} from AndroidManifest.xml: ${packageName}"
                    } else {
                        println "Warning: Could not set namespace for ${project.name} as package name is missing in AndroidManifest.xml."
                    }
                } else {
                    println "Warning: AndroidManifest.xml not found in ${project.name}. Cannot set namespace."
                }
            }
        }
    }
}
dominolog commented 3 weeks ago

Please make a new release with the namespace attribute

larsien commented 2 weeks ago

please merge!

DmitriySimonov commented 1 week ago

please merge