-
-
Notifications
You must be signed in to change notification settings - Fork 135
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 with "Namepace not specified" error #157
Comments
edit android/settings.gradle
edit android/gradle/wrapper/gradle-wrapper.properties
My colleague told me to do so. I don't know why but it works. |
i do have a same issue... any fix would be greate. |
This fixes the issue for me too. Also it works because you are setting the version of gradle you use to be compatible with the one flutter_js uses. As for if any other issues will pop up because of it, I guess I'll find out eventually. |
that is the problem i dont want/ i cannot downgrade gradle.. :( |
Oh, in that case, you'll have to set up the package as a local dependency and go into their gradle files and update them to match yours. If you need help doing it, chatgpt and google are your friends. I ended up having to set up a local dependency anyway in order to get a proper release build, so you may as well. |
If you run newest dart, flutter and gradle you probably have to edit the plugin FAILURE: Build failed with an exception.
BUILD FAILED in 2s
HERE IS A FIX: add
to your pubspec dependencies Delete EXAMPLES subproject Go to flutter_js/android/build.gradle and edit You can leave a reaction if this helps <3 |
This is you downgrading the plugin version which isn't a viable long term solution. |
An alternative fix is to add all missing namespaces by adding this snippet to the project gradle.build just after the first "subprojects" statement. This avoids having to fork or clone the original library into your project. subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
} Kudos to this Stack Overflow answer by Dmytro Puzak. Note that this solution might lead you to another known Flutter problem: "AAPT: error: resource android:attr/lStar not found." (See this GitHub issue) A solution from that GitHub thread is this additional snippet: subprojects {
afterEvaluate { project ->
if (project.extensions.findByName("android") != null) {
Integer pluginCompileSdk = project.android.compileSdk
if (pluginCompileSdk != null && pluginCompileSdk < 31) {
project.logger.error(
"Warning: Overriding compileSdk version in Flutter plugin: "
+ project.name
+ " from "
+ pluginCompileSdk
+ " to 31 (to work around https://issuetracker.google.com/issues/199180389)."
+ "\nIf there is not a new version of " + project.name + ", consider filing an issue against "
+ project.name
+ " to increase their compileSdk to the latest (otherwise try updating to the latest version)."
)
project.android {
compileSdk 31
}
}
}
}
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(":app")
} Credits for this solution go to Gray Mackall and Dick Verweij. |
The text was updated successfully, but these errors were encountered: