-4

I am using android studio. When I compile it will terminate the process. I have error at build.gradle . Anyone can help me solve the problem? Thank you very much

Here is my 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'
}

Here is the error:

 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
Zoe
  • 27,060
  • 21
  • 118
  • 148
dipgirl
  • 648
  • 3
  • 17
  • 28
  • Possible duplicate of [Error: fix the version conflict (google-services plugin)](https://stackoverflow.com/questions/45500934/error-fix-the-version-conflict-google-services-plugin) – Zoe Apr 07 '19 at 08:37

2 Answers2

1

Add these into dependencies

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"
qing
  • 785
  • 1
  • 10
  • 24
0

Migrating to androidx works fine for me.

To do that, go to Refactor option in the ribbon and then click Migrate to AndroidX. If you are new to AndroidX, then save a copy of the project when asked and then migrate.

This will change the dependencies to androidx artifacts and resolve your issue.

Gourav
  • 2,746
  • 5
  • 28
  • 45