报错信息
A problem occurred configuring project ':isar_flutter_libs'. > 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.com/r/tools/upg… 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 d.android.com/r/tools/upg… for general information about using the AGP Upgrade Assistant.
解决办法
- 在 android >>
build.gradle
文件中,新增一个 subprojects - 需要注意位置,在
subprojects { project.evaluationDependsOn(":app") }
前面新增。 - 原文链接:stackoverflow.com/questions/7… stackoverflow.com/questions/7…
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
// 添加如下 subprojects
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
subprojects {
project.evaluationDependsOn(":app")
}