微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 了解为什么gradle会抱怨碰撞版本

我一直试图带回我的旧应用程序,我用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'

并决定停止使用整个版本的工件.

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可以找到的最新产品.而且,上周,谷歌发布了28.0.0-alpha1,与Android P Developer Preview 1的发布同步发布.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐