当前位置: 首页 > 知识库问答 >
问题:

一切正常。Android支持库必须使用完全相同的版本规范。在android studio 2.3中找到了版本27.0.2、25.1.0、25.0.0

微生承业
2023-03-14

我有一个错误在gradle文件编译'com.android.support: appcompat-v7:27.0.2'.

gradle版本是2.3.0

我找了很多,但没能解决这个问题。我的错误是:

一切正常。Android支持库必须使用完全相同的版本规范(混合版本可能会导致运行时崩溃)。找到了版本27.0.2、25.1.0、25.0.0。例如com.Android支持:动画矢量绘图:27.0.2和com.Android支持:设计:25.1.0

app/build。格雷德尔

android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
    applicationId "com.example.pegah_system.sanduqchehproject"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
}
dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.squareup.retrofit2:retrofit:2.0.0-beta4') {   
    exclude module: 'okhttp'
}
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
compile 'com.github.ybq:Endless-RecyclerView:1.0.3'
compile 'com.github.ybq:Android-SpinKit:1.1.0'
compile 'com.github.qdxxxx:BezierViewPager:v1.0.5'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.roughike:bottom-bar:2.1.2'
compile 'com.squareup.okhttp3:okhttp:3.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:support-v4:27.0.2'
testCompile 'junit:junit:4.12'
}

共有2个答案

柯建修
2023-03-14

尝试在依赖树中检查您的依赖项,您可以在终端中使用以下命令显示它:

./gradlew app:dependencies

模块是

在那里你可以找到错误信息com中提到的例子。Android支持:动画矢量绘图:27.0.2com.Android支持:设计:25.1.0并检查其版本。

当我遇到这种依赖性问题时,我通常会尝试一个接一个地删除它们,看看冲突从何而来。

司空均
2023-03-14

问题是因为项目中存在冲突的依赖关系。您使用的一些库隐式地使用了support library27.0.225.1.025.0.0

以下库使用的支持库与27.0.2不同:

compile 'com.github.qdxxxx:BezierViewPager:v1.0.5'
compile 'com.roughike:bottom-bar:2.1.2'

BezierViewPager在其内部版本中使用支持库。格雷德尔:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.0'
    testCompile 'junit:junit:4.12'


    compile 'com.android.support:cardview-v7:25.0.0'
    compile 'com.github.bumptech.glide:glide:3.6.1'
}

底部条形图库在其构建中使用支持库25.0.2。gradle和图书馆建设。格雷德尔:

ext {
    compileSdkVersion = 25
    buildToolsVersion = "25.0.2"
    minSdkVersion = 11
    targetSdkVersion = 25
    supportLibraryVersion = "25.3.0"

    junitVersion = "4.12"
}

因此,您需要将支持库从它们中排除。你可以这样做:

  compile ("com.github.qdxxxx:BezierViewPager:v1.0.5") {
    exclude group: 'com.android.support'
    exclude module: 'appcompat-v7'
    exclude module: 'cardview-v7'
  }

  compile ("com.roughike:bottom-bar:2.1.2") {
    exclude group: 'com.android.support'
    exclude module: 'appcompat-v7'
    exclude module: 'design'
  }

如果仍然发现存在以下冲突的库,则可以检查依赖关系树:

./gradlew app:dependencies
 类似资料:
  • 所有com.android.support库都必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到的版本28.0.0, 26.1.0。示例包括com.android.support:动画-矢量-绘图:28.0.0和com.android.support:支持-媒体-比较:26.1.0少(Ctrl F1)有一些库或工具和库的组合不兼容,或者可能导致错误。其中一种不兼容是使用不是最新版本的A

  • 这是我的错误,整个项目都依赖于此 我的Gradle代码如下 再看一遍 这个错误是怎么发生的?我更新了android studio和gradle并构建了工具,因为我希望所有东西都是最新的,这个错误突然出现,我尝试了所有可能的方法来解决它,但失败了。只是这个错误没有解决,我的应用程序已经准备好了。 当前gradle是3.3,android Studio是2.3.1,最新的26个支持库appcompat

  • 我是Android开发的新手,我正在制作Firebase聊天应用,但突然间我面临着传递依赖的问题。我跟踪了这个链接不要用于库版本。但没能解决问题。这是我的代码build.gradle(模块), 我面临以下错误, 所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。发现版本26.0.0-alpha1,25.1.0。示例包括com.android.su

  • 我的android Studio显示此错误。 所有com.android.support库都必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到的版本27.1.1, 26.1.0。示例包括com.android.support:动画-矢量-绘图: 27.1.1和com.android.support:支持-媒体-比较: 26.1.0更少...(Ctrl F1)有一些库或工具和库的组合不兼

  • 我试着用一个特定的活动运行我的应用程序,我一个连续的崩溃正在发生。 我发现了一个与appcompat版本有关的错误。然而,我不确定如何修复这个错误,即获取我的所有依赖在同一版本。 我想知道有没有一个快速的解决办法?如果不是,有什么步骤来确保它们都在正确的/相同的版本上? 任何帮助都将不胜感激。多谢了。

  • 在将targetSdkVersion更新到27之后,我得到了这个错误消息。 所有com.android.support库必须使用完全相同的版本规范(混合版本会导致运行时崩溃)。找到版本27.0.2、25.2.0.示例包括和 我知道我应该更新,但我不知道该如何更新,因为我没有在build.gradle中使用它,所以我尝试更新SDK工具,但问题仍然存在。波纹管已建好。级: