【发布时间】:2018-05-08 22:12:13
【问题描述】:
在我的Unity 项目中集成Firebase 和Fabric 时遇到困难。我最终设法通过安装Firebase 插件和Fabric 插件让它们一起工作(它从来没有反过来工作)。问题是我只在 Firebase 控制台中看到 Firebase 事件,而没有看到 Fabric/Answers 事件(我可以在 Fabric 中看到这些事件,因此我知道触发了事件)。
问题 1:我正在使用 Unity 生成我的 APK,这可能是问题吗?我应该使用带有 gradle 的 Android Studio 吗?
问题2:我尝试使用 gradle 在 Android Studio 中构建我的应用,但启动应用时出现错误:
Didn't find class "io.fabric.unity.android.FabricApplication" on path: DexPathList[[zip file "/data/app/com.domain.appname-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.domain.appname-1, /vendor/lib, /system/lib]]
由于我是 gradle 新手,对于这样的项目(即 Unity with Firebase 和 Fabric),什么是正确的 gradle?
有关信息,我的build.gradle 如下所示:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.firebase:firebase-core:11.4.2'
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true
}
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
targetSdkVersion 25
applicationId 'com.domain.appname'
}
lintOptions {
abortOnError false
}
signingConfigs { release {
storeFile file('xxxxx')
storePassword 'xxxxxx'
keyAlias 'xxxxxx'
keyPassword 'xxxxxx'
} }
buildTypes {
debug {
jniDebuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
signingConfig signingConfigs.release
}
}
}
apply plugin: 'com.google.gms.google-services'
更新 1:
我又经历了一次这个过程,现在在 Tools->Firebase 下的 Fabric 控制台中发现了一个错误,说我的 Crashlytics SDK 不是最新的。
Crashlytics SDK is not up to date
我已经从Fabric for Unity plugin 重新安装了最新的 Fabric/Crashlytics Unity 插件。在 Unity 中,它显示为 Crashlytics v1.2.5,这是 Fabric 上指示的最新版本:Fabric changelog
这是我现在想知道通过使用 gradle 是否能够以某种方式更新我的 Fabric SDK 的时候。
【问题讨论】:
-
您应该可以让 Unity 生成您的 apk。您是否在 Fabric 和 Firebase 之间关联了您的应用程序? docs.fabric.io/android/answers/android-export-firebase.html
-
@Alexizamerican 感谢您的帮助。我的应用在 Fabric 和 Firebase 之间链接。我已经在我的问题中添加了一个更新,因为我再次经历了这个过程,我现在可以看到问题可能是 Crashlytics SDK 不是最新的,这很奇怪,因为我有我能找到的最新的 Fabric 统一插件。
-
感谢您提供更多详细信息。我已向团队确认,我们尚未更新 Unity SDK 以支持 Fabric Answers to Firebase 集成。我正在与团队合作发布更新,以便我们支持这一点。请继续关注,一旦它上线,我会添加更新。
-
感谢您的信息。在等待更新时,任何关于 gradle 的建议都将不胜感激。
标签: android firebase unity3d google-fabric