Android Studio:“所有com.android.support库都必须使用完全相同的版本规范“

时间:2019-02-22 17:50:46

标签: android android-studio sdk libraries

我正在尝试编写应用程序代码。我的三星手机的Android版本是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

1 个答案:

答案 0 :(得分:0)

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

implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
相关问题