在我更新我的gradle到8.0后,如果我在android build.gradle中设置了命名空间,则在构建apk事件时会出现错误命名空间
这是我的build gradle代码
build.gradle:android/app
android {
compileSdkVersion localProperties.getProperty('flutter.compileSdkVersion').toInteger()//33
namespace 'com.appidname.here'
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.appidname.here"
minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()//21
targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()//33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
....
}
build.gradle:android
buildscript {
ext.kotlin_version = '1.8.22'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
....
这是我得到的错误时,buil apk或appbuble.
错误
* What went wrong:
A problem occurred configuring project ':webview_pro_android'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
> Namespace not specified. Please specify a namespace in the module's build.gradle file like so:
android {
namespace 'com.example.namespace'
}
从错误我认为命名空间不设置在所有的插件模块还。如何解决这个问题,如何为所有插件模块添加命名空间?谢谢
1条答案
按热度按时间zsohkypk1#
你可以像这样修改你的
build.gradle
文件。