gpt4 book ai didi

Android依赖 'com.android.support:support-v4'有不同的版本

转载 作者:IT老高 更新时间:2023-10-28 12:32:50 27 4
gpt4 key购买 nike

我刚刚升级到 Dart 2 和最新版本的 Flutter,现在我无法构建我的应用程序。我在互联网上环顾四周,但仍然不明白为什么会发生这种情况。

我得到的错误是:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:support-v4' has different version for the compile (26.1.0) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution

项目构建等级:

buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.2.1'
}
}

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
}

pubspec.yaml:

dependencies:
flutter:
sdk: flutter

cupertino_icons: ^0.1.2
google_sign_in: ^3.0.2
firebase_auth: ^0.5.5
firebase_database: ^0.4.5
firebase_core: ^0.2.3

flutter_blue: ^0.3.3

dev_dependencies:
flutter_test:
sdk: flutter


# The following section is specific to Flutter.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

我已将我的包更新到最新版本,并且正在运行最新版本的 Dart 和 Flutter。

我真的不明白是什么导致了这个错误。

有人可以帮忙吗?

最佳答案

将以下内容添加到 Android 项目级别的 build.gradle 文件的“子项目”部分(正如 Günter Zöchbauer 在评论中提供的 link 中所述):

   subprojects {

project.evaluationDependsOn(':app')
//[PART TO ADD START]
project.configurations.all {

resolutionStrategy.eachDependency { details ->

if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "27.1.0"
}
}
}
//[PART TO ADD END]
}

关于Android依赖 'com.android.support:support-v4'有不同的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49934127/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com