本文介绍了Firebase版本与支持库冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道这是一个常见问题,我已经阅读了几篇文章,并多次修改了gradle文件,但找不到解决方法.
I know this is a common question and I already read several posts and modify many times my gradle file but I can't find the solution.
但是我不知道26.1.0的版本在哪里.知道如何解决吗?
But I don't know where the 26.1.0 version is. Any idea how to fix it?
这是我的 build.gradle(module:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.emojify_kotlin"
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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.google.firebase:firebase-core:16.0.8'
}
apply plugin: 'com.google.gms.google-services'
这是我的项目gradle文件
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}}
allprojects {
repositories {
google()
jcenter()
}}
task clean(type: Delete) {
delete rootProject.buildDir}
推荐答案
使用gradle app:dependencies
,获取依赖项列表:
Using gradle app:dependencies
, get a list of dependencies:
+--- org.jetbrains.kotlin:kotlin-stdlib-jre7:..
| \--- org.jetbrains.kotlin:kotlin-stdlib:..
| \--- org.jetbrains:annotations:...
+--- com.google.firebase:firebase-core:16....
| +--- com.google.firebase:firebase-analytics:16...
| | +--- com.google.android.gms:play-services-basement:15....
| | | \--- com.android.support:support-v4:26.1.0
| | | +--- com.android.support:support-compat:26.1.0 ->.......
它显示Firebase所需的com.android.support:support-v4:26.1.0
,因此您必须覆盖它与 com.android.support:support-v4:28.0.0
it shows firebase needed com.android.support:support-v4:26.1.0
, so you have to overwritten itwith com.android.support:support-v4:28.0.0
这篇关于Firebase版本与支持库冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!