在 android 工作室编译失败
Compile failed at android studio
我正在使用 android 工作室。当我编译时它会终止进程。我在 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
将这些添加到依赖项中
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"
迁移到 androidx 对我来说很好。
为此,请转到功能区中的重构选项,然后单击迁移到 AndroidX。如果您是 AndroidX 的新手,请在系统询问时保存项目副本,然后进行迁移。
这将更改对 androidx 工件的依赖关系并解决您的问题。
我正在使用 android 工作室。当我编译时它会终止进程。我在 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
将这些添加到依赖项中
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"
迁移到 androidx 对我来说很好。
为此,请转到功能区中的重构选项,然后单击迁移到 AndroidX。如果您是 AndroidX 的新手,请在系统询问时保存项目副本,然后进行迁移。
这将更改对 androidx 工件的依赖关系并解决您的问题。