Android Appcompat-v7 错误

标签 android android-studio build.gradle android-appcompat

我使用的是android studio 2.3.1,在android build.gradle中

compile 'com.android.support:appcompat-v7:23.4.0'

有错误

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 24.0.0, 23.4.0. Examples include com.android.support:support-v4:24.0.0 and com.android.support:animated-vector-drawable:23.4.0

这是我的 build.gradle

apply plugin: 'com.android.application'   

android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
    applicationId "com.wsolus.chathuranga.simplifya"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 22
    versionName "2.0.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
} } dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
  compile('org.apache.httpcomponents:httpmime:4.3') {
    exclude module: "httpclient"
}
  compile 'com.android.support:appcompat-v7:23.4.0'
  compile 'com.android.support:design:23.4.0'
  compile 'com.android.support:support-v4:23.4.0'

}

请帮帮我 谢谢

这是 gradle 的屏幕截图:

This is a screen shot of the gradle

最佳答案

像这样更改你的 gradle 文件,然后转到文件->使缓存无效并重新启动

apply plugin: 'com.android.application'   

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
useLibrary 'org.apache.http.legacy'
defaultConfig {
    applicationId "com.wsolus.chathuranga.simplifya"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 22
    versionName "2.0.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
} } dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
  compile('org.apache.httpcomponents:httpmime:4.3') {
    exclude module: "httpclient"
}
  compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.android.support:design:24.2.0'
    compile 'com.android.support:support-v4:24.2.0'
    compile 'com.android.support:palette-v7:24.2.0'

}

关于Android Appcompat-v7 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43485981/

相关文章:

flutter - Android studio -> firebase 工具不断加载

Android web view "back"按钮加载之前加载的div

java - 如何通过函数调用启用 float 操作按钮?

android-studio - 为 Android Studio 中的方法生成 KDoc

android - 如何在一个 fragment 中收集数据并在 android studio 中的另一个 fragment 中显示它,我正在使用共享首选项来执行此操作

ANDROID: org.gradle.api.GradleException: 找不到满足版本约束的 'org.jetbrains.kotlin:kotlin-stdlib' 版本

android - 如果我安装了 Facebook 应用程序,我的 Facebook 登录 Android 应用程序将不会打开 session

java - ClassCastException : android. widget.TextView 无法转换为 android.widget.ListView

intellij-idea - 当我按下“立即同步”和“刷新”按钮时,IDEA/Android Studio 会运行​​哪些 Gradle 任务?

android - 使用多个 keystore 文件生成多个 apk