gpt4 book ai didi

android - 不断在build.gradle中更改版本的firebase-core。包括firebase-core的最佳方法?

转载 作者:行者123 更新时间:2023-12-03 05:50:22 26 4
gpt4 key购买 nike

我觉得在app/build.gradle文件中,我经常需要版本Bump Firebase-core。我已经将Firebase包含在安装程序中。

apply plugin: 'com.android.application'

android {
// ...
}

dependencies {
compile project(':react-native-fetch-blob')
compile project(':react-native-locale')
compile project(':react-native-fs')
compile project(':react-native-view-shot')
compile project(':react-native-share')
compile project(':react-native-vector-icons')
compile project(':react-native-spinkit')
compile project(':react-native-image-picker')
compile project(':react-native-device-info')
compile project(':react-native-camera')
compile project(':react-native-sqlite-storage')
compile fileTree(dir: "libs", include: ["*.jar"])
compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') { transitive = true; }
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.facebook.react:react-native:+'
compile 'com.google.firebase:firebase-core:11.8.0'

// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

当版本不是最新时,编译将失败并显示错误。
Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzfgf;
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzfgf;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)

:app:transformClassesWithDexForProdDebug FAILED

有没有更好的方法来包含fireabse?

最佳答案

我有一种更容易实现的方式...

现在在根build.gradle中定义一个变量

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
googlePlayServicesVersion = "16.+"
}

然后在应用程序的`build.gradle中
dependencies {
implementation "com.google.firebase:firebase-core:${rootProject.ext.googlePlayServicesVersion}"

}

这有点怪异,因为您会获得次要版本的最新版本/

关于android - 不断在build.gradle中更改版本的firebase-core。包括firebase-core的最佳方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48155132/

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