1. 总是出现错误 可以添加以下命令
在app/build.gradle 里面添加
android {
namespace = "com.example.untitled"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
}
dependencies {
implementation 'com.google.code.findbugs:jsr305:3.0.2' // 保持这个依赖,确保项目所需
implementation 'androidx.annotation:annotation-experimental:1.4.1'
}
在根目录里面的build.gradle
allprojects {
repositories {
google()
mavenCentral() {
metadataSources {
mavenPom()
artifact()
}
}
maven {
url 'https://maven.aliyun.com/repository/central'
metadataSources {
mavenPom()
artifact()
}
}
maven {
url 'https://mirrors.tuna.tsinghua.edu.cn/maven2/'
metadataSources {
mavenPom()
artifact()
}
}
}
}
setting.gradle
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.0.2" apply false
id "org.jetbrains.kotlin.android" version "1.8.20" apply false
}
gradle-wrapper
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip