从以下位置更新依赖项类路径时,会发生此问题: 'com.android.tools.build:gradle:3.2.1' 到 *'com.android.tools.build:gradle:3.3.2'< / strong>
项目级 build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用级 build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "org.company.com.flutter_app"
minSdkVersion 19
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
}
pubspec.yaml
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_svg: ^0.12.0
printing: ^2.0.0
image: ^2.0.7
答案 0 :(得分:9)
在检查以下两个链接后,我遇到了同样的问题: https://flutter.dev/docs/deployment/android
和proguard。唯一对我有用的是删除minifyEnabled true
fom build.graddle。
希望对您有所帮助。
答案 1 :(得分:0)
似乎您正在使用与Androidx不兼容的Flutter依赖关系,请尝试注释最近的依赖关系并重新运行它,如果可行,请尝试使用与Androidx兼容的依赖关系
答案 2 :(得分:0)
将此添加到android / gradle.properties中:
android.useAndroidX=true
android.enableJetifier=true
参考:https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility