flutter_compass
flutter_compass copied to clipboard
Causes build failure for Android
Please add the required line in the android tag in the build.gradle file:
namespace "compass"
This solves
FAILURE: Build failed with an exception.
- What went wrong: A problem occurred configuring project ':flutter_compass'.
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.
yes, an error occurs
We would also greatly appreciate this being resolved ❤️
Looking at this, best we use the Android namespace name
namespace "com.hemanthraj.fluttercompass"
https://github.com/hemanthrajv/flutter_compass/pull/116
Looks resolved. But I do not see a release.
@hemanthrajv pls
ditto, all builds using gradle 8 or later require the namespace to be set
update it, please
thank you, this helped!
When will this be released?
@xVemu please fix this
@xVemu please fix this
I'm not owner of the repo
@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 = [email protected]()
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."
}
}
}
}
}
Please make a new release with the namespace attribute
please merge!
please merge
This can be closed