android - 添加 facebook 依赖 gradle 错误
问题描述
我添加了以下依赖项,login with facebook
然后错误可以显示给我。
implementation 'com.facebook.android:facebook-login:[4,5)'
下面的错误告诉我:
所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 27.1.1、27.0.2。示例包括 com.android.support:animated-vector-drawable:27.1.1 和 com.android.support:customtabs:27.0.2 less... (Ctrl+F1) 有一些库的组合,或者工具和库,不兼容或可能导致错误。一种这样的不兼容性是使用不是最新版本的 Android 支持库版本(或者特别是低于您的 targetSdkVersion 的版本)进行编译。
Gradle.build(应用程序):
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
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.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.+'
implementation 'com.android.support:recyclerview-v7:27.1.+'
implementation 'com.github.bumptech.glide:glide:4.3.1'
//Volley
implementation 'com.android.volley:volley:1.0.0'
//facebook
implementation 'com.facebook.android:facebook-login:[4,5)'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.intuit.ssp:ssp-android:1.0.5'
implementation 'com.intuit.sdp:sdp-android:1.0.5'
implementation 'com.ramotion.foldingcell:folding-cell:1.2.2'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation project(':revealfab')
}
解决方案
由于错误明确提到混合 lib 版本不是一个好主意(混合版本会导致运行时崩溃),所以不要那样做。在这里你使用7:27.1.1
and 7:27.1.+
。因此,为所有库保持相同的版本。
代替:
implementation 'com.facebook.android:facebook-login:[4,5)' // this is wrong
implementation 'com.android.support:cardview-v7:27.1.+'
implementation 'com.android.support:recyclerview-v7:27.1.+'
利用:
implementation 'com.facebook.android:facebook-login:4.35.0' //latest version and correct correct way
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
推荐阅读
- php - 为酒店系统创建嵌套 json
- ios - 如何修复在生产中失败的应用内购买?
- angular - 要转换的动画材质图标:Hamburger to X
- javascript - 使用javascript单击图像时如何从数组中播放每个视频?
- excel - 如何使用 VBA 打开宏工作簿?
- android - 如何在欢迎句之后和用户输入数据之前放置一个句子?
- python - 在 mac 上安装 torchaudio 时的一些问题
- java - 如何使用firebase监听android studio中的变化
- ruby-on-rails - 使用linkedin凭据登录时出现Oauth登录错误(“错误”:“https_required”)
- laravel - 如何在 Laravel 5.8 中加入表格