【问题标题】:Android studio: "All com.android.support libraries must use the exact same version specification "Android studio:“所有 com.android.support 库必须使用完全相同的版本规范”
【发布时间】:2019-02-22 17:50:46
【问题描述】:

我正在尝试编写应用程序。我的三星手机是安卓8.0。我以为我的应用程序崩溃了,因为我在 8.1 (API 27) 上运行它。所以我降级了SDK版本等。但是现在当我尝试构建一个APK时,它给了我这个错误:

所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 27.1.1、26.1.0。示例包括 com.android.support:animated-vector-drawable:27.1.1 和 com.android.support:design:26.1.0 less... (Ctrl+F1) 有一些库或工具和库的组合是不兼容的,或者可能导致错误。一种这样的不兼容性是使用不是最新版本的 Android 支持库版本进行编译(或者特别是低于您的 targetSdkVersion 的版本)。

我的 build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.example.socialapps.socialme"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
    buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
    }
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- 
core:3.0.2'
}

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

'implementation 'com.android.support:design:26.1.0' 带有红线下划线。有人能帮助我吗?谢谢:D

【问题讨论】:

标签: android android-studio sdk libraries


【解决方案1】:

关键字compile 已弃用。将它们替换为implementation word.. 并更新库的版本.. 为此,您可以将光标设置在任何库上,然后按 Alt + Enter 并选择 update to .... 例如将这些库更改为这些版本:

implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'

【讨论】:

    猜你喜欢
    • 2019-08-07
    • 2017-11-12
    • 1970-01-01
    • 2018-05-28
    相关资源
    最近更新 更多