gpt4 book ai didi

android - 混合版本会导致 Firebase 中的运行时崩溃吗?

转载 作者:太空狗 更新时间:2023-10-29 14:38:48 25 4
gpt4 key购买 nike

以下是我的 gradle 文件:

apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'


android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "???"
minSdkVersion 21
targetSdkVersion 27
versionCode 4
versionName "1.02"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {

minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

realm {

syncEnabled = true
}
}

dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':EBS')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:gridlayout-v7: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.afollestad.material-dialogs:commons:0.9.6.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'

implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'

implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
}

apply plugin: 'com.google.gms.google-services'

//顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。

buildscript {

repositories {
google()
jcenter()
maven {

url 'https://maven.fabric.io/public'

}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath "io.realm:realm-gradle-plugin:5.4.1"
classpath 'com.google.gms:google-services:4.0.2'
classpath 'io.fabric.tools:gradle:1.25.4'
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.0.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
maven {

url 'https://jitpack.io'
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

这里我在我的项目中添加了 firebase core 和 firebase messaging,但是我面临着

"All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 17.1.0, 16.2.0, 16.1.1, 16.0.1, 16.0.0, 15.0.1. Examples include com.google.firebase:firebase-messaging:17.1.0 and com.google.firebase:firebase-iid:16.2.0 less... (⌘F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)"

你能帮我解决这个问题吗?

最佳答案

我也遇到了同样的问题,我是如何解决这个问题的:

由于 gradle 发出警告混合版本会导致运行时崩溃,并且 gradle 将给出示例 include 以便:

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 17.1.0, 16.2.0, 16.1.1, 16.0.1, 16.0.0, 15.0.1. Examples include com.google.firebase:firebase-messaging:17.1.0 and com.google.firebase:firebase-iid:16.2.0 less... (⌘F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)

正如你在上面的语句中看到的

Examples include com.google.firebase:firebase-messaging:17.1.0 and com.google.firebase:firebase-iid:16.2.0 less...

所以只需添加任何引起版本冲突并由 gradle 提到的依赖项

implementation com.google.firebase:firebase-messaging:17.1.0
implementation com.google.firebase:firebase-iid:16.2.0

添加依赖项后,gradle 可能会包含更多依赖项,因此也添加这些依赖项。

注意:Gradle 显示此警告是因为您正在使用一些正在使用其他的第三方库

关于android - 混合版本会导致 Firebase 中的运行时崩溃吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51685205/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com