【问题标题】:android gradle com.android.support libraries version issueandroid gradle com.android.support 库版本问题
【发布时间】:2018-05-15 17:09:28
【问题描述】:

当我构建我的 gradle 时,我遇到了一个错误。提示显示:

所有 com.android.support 库必须使用完全相同的版本规范(混合版本会导致运行时崩溃)。找到版本 27.0.2、25.3.1 示例包括 com.android.support:animated-vector-drawable:27.0.2 和 com.android.support:design:25.3.1

这是我的毕业典礼:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':rest')
// Google
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services:10.2.4'


// Analytics
// Fabric + Crashlytics
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
    transitive = true;
}
compile 'com.google.android.gms:play-services-analytics:10.2.4'
compile 'com.google.firebase:firebase-core:10.0.1'

// Facebook
compile 'com.facebook.android:facebook-android-sdk:4.+'
// Tools
// App Intro
compile 'com.github.paolorotolo:appintro:4.1.0'
// FloatingActionButton menu
compile 'com.github.clans:fab:1.6.1'
// Animation items for RecyclerView
compile 'jp.wasabeef:recyclerview-animators:2.0.1'
// Photo banner
compile 'com.bigkoo:convenientbanner:2.0.5'
// Time picker support for 4.0+
compile 'com.wdullaer:materialdatetimepicker:2.5.0'
// Displays the relative time with respect to the reference point
compile 'com.github.curioustechizen.android-ago:library:1.3.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.15.0'
// Image loader (for high resolution pics)
compile 'com.github.bumptech.glide:glide:3.7.0'
// Icon font
compile "com.mikepenz:iconics-core:2.8.1@aar"
compile 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar'
compile 'com.mikepenz:material-design-iconic-typeface:2.2.0.2@aar'
compile 'com.wang.avi:library:2.1.3'

compile 'com.tomergoldst.android:tooltips:1.0.6'
}

我也关注这个answer 改变

编译'com.android.support:design:25.3.1'

编译'com.android.support:design:27.0.2'

但是,在我同步我的项目之后。提示显示:

此支持库不应使用与 compileSdkVersion(25) 不同的版本 (27)

【问题讨论】:

标签: android android-studio build.gradle


【解决方案1】:

我有同样的问题,在我的情况下与使用 4.33.0 而不是 4.+ 的 facebook sdk 版本有关,并将您的支持库更新到版本 27.0.2

【讨论】:

    【解决方案2】:

    确保为您的支持库使用最新版本 (27.1.1)。也从编译更改为实现,编译已被弃用。最后,在应用级别的 build.gradle 文件中将 compileSdkVersion 更改为 27。

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':rest')
    // Google
    implementation 'com.android.support:multidex:1.0.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:mediarouter-v7:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.android.gms:play-services:10.2.4'
    
    
    // Analytics
    // Fabric + Crashlytics
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    implementation 'com.google.android.gms:play-services-analytics:10.2.4'
    implementation 'com.google.firebase:firebase-core:10.0.1'
    
    // Facebook
    implementation 'com.facebook.android:facebook-android-sdk:4.+'
    // Tools
    // App Intro
    implementation 'com.github.paolorotolo:appintro:4.1.0'
    // FloatingActionButton menu
    implementation 'com.github.clans:fab:1.6.1'
    // Animation items for RecyclerView
    implementation 'jp.wasabeef:recyclerview-animators:2.0.1'
    // Photo banner
    implementation 'com.bigkoo:convenientbanner:2.0.5'
    // Time picker support for 4.0+
    implementation 'com.wdullaer:materialdatetimepicker:2.5.0'
    // Displays the relative time with respect to the reference point
    implementation 'com.github.curioustechizen.android-ago:library:1.3.0'
    implementation 'com.paypal.sdk:paypal-android-sdk:2.15.0'
    // Image loader (for high resolution pics)
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    // Icon font
    implementation "com.mikepenz:iconics-core:2.8.1@aar"
    implementation 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar'
    implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.2@aar'
    implementation 'com.wang.avi:library:2.1.3'
    
    implementation 'com.tomergoldst.android:tooltips:1.0.6'
    }
    

    【讨论】:

    • 谢谢!改成sdk 27​​并添加implementation "com.android.support:customtabs:27.1.1"后没有出现错误。
    猜你喜欢
    • 2017-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-15
    • 1970-01-01
    相关资源
    最近更新 更多