gpt4 book ai didi

android - 理解为什么 gradle 提示版本冲突

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:40:46 27 4
gpt4 key购买 nike

我一直在尝试恢复我的一个旧应用程序,那是我之前使用 Eclipse 编写的。我导入到 android-studio,它提示版本冲突:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha1, 27.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-alpha1 and com.android.support:cardview-v7:27.1.0

一开始我按照this的建议解决了问题,通过将冲突的包专门包含在具有较新版本的 gradle 文件中。所以我的 gradle 文件最终是这样的:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.tomklino.imhere"
minSdkVersion 16
targetSdkVersion 19
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}


dependencies {
implementation 'com.android.support:appcompat-v7:+'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:customtabs:27.1.0'
implementation 'com.android.support:support-media-compat:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation "com.google.android.gms:play-services-gcm:11.8.0"
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
}

apply plugin: 'com.google.gms.google-services'
}

这删除了 ​​appcompat 行下的红线,但随后,在调试其他内容后,我再次收到上面的消息,但这次是版本 28.0.0-alpha1。现在我不能包含新版本,因为如果我尝试它说它与 27 的 sdk 版本不兼容。

如果我没有在任何地方包含那个 sdk 版本,我试图理解为什么它首先要求那个版本。依赖关系树中没有任何内容专门要求 28.0.0-alpha1 版本。

最佳答案

but then, after debugging something else, I got the message above again, but this time with the version 28.0.0-alpha1

替换:

implementation 'com.android.support:appcompat-v7:+'

与:

implementation 'com.android.support:appcompat-v7:27.1.0'

并决定停止对 Artifact 的整个版本使用 +

I'm trying to understand why it asks for that version in the first place if I havn't included that sdk version anywhere.

您使用 + 作为 appcompat-v7 的版本。这表示您想要 Gradle 可以找到的最新版本。上周,Google 发布了 28.0.0-alpha1,同时发布了 Android P Developer Preview 1。

关于android - 理解为什么 gradle 提示版本冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49235737/

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