Android Studio编译失败

时间:2019-04-07 06:14:53

标签: android android-gradle

我正在使用android studio。当我编译时,它将终止该过程。我在build.gradle时出错。有人可以帮助我解决问题吗?非常感谢

这是我的build.gradle

    apply plugin: 'com.android.application'

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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'

    implementation 'com.edwardvanraak:MaterialBarcodeScanner:0.0.6-ALPHA'
    implementation 'cz.msebera.android:httpclient:4.3.6'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.koushikdutta.ion:ion:2.+'
    implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
    implementation 'com.google.android.gms:play-services-location:7.+'
    implementation 'org.jsoup:jsoup:1.9.2'
    implementation 'com.github.f0ris.sweetalert:library:1.5.1'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.wang.avi:library:2.1.3'
    implementation 'com.google.android.gms:play-services:9.8.0'
}

这是错误:

 All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 24.0.0, 23.0.1. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:mediarouter-v7:24.0.0 less... (Ctrl+F1) 
    Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).  
Issue id: GradleCompatible

2 个答案:

答案 0 :(得分:0)

将它们添加到依赖项中

implementation "com.android.support:design:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation "com.android.support:mediarouter-v7:28.0.0"
implementation "com.android.support:customtabs:28.0.0"

答案 1 :(得分:0)

迁移到androidx对我来说很好。

为此,请转到功能区中的“重构”选项,然后单击“迁移到AndroidX”。如果您不熟悉AndroidX,请在询问时保存项目的副本,然后进行迁移。

这会将依赖项更改为androidx工件并解决您的问题。