我正在实施和添加FirebaseCrash的InstantApp。
我按照所有步骤进行设置,当我使用可安装版本的构建配置运行应用程序时,它就像魅力一样,但是当我尝试运行InstantApp FirebaseCrash的构建配置时,应用程序崩溃了。< / p>
此行中的应用程序崩溃,我正在模拟崩溃,以检查它是否有效:
FirebaseCrash.logcat(Log.ERROR, "Firebase", "I am broken!!");
当我为InstantApp运行它时崩溃:
Process: uk.co.alpha.test.app, PID: 3516
java.lang.RuntimeException: Unable to start activity
ComponentInfo{[package.class]}: java.lang.IllegalStateException:
Default FirebaseApp is not initialized in this process [package] Make
sure to call FirebaseApp.initializeApp(Context) first.
我尝试在崩溃的类的onCreate中添加FirebaseApp.initializeApp(Context),我也尝试在从Application扩展的类中添加它,但会出现同样的崩溃。
我查看了stackoverflow和官方的Firebase文档,但我没有找到任何针对InstantApps的内容
它适用于可安装版本,但我添加了我的gradle文件,以防万一它可以帮助解决它:
./的build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com'}
//Dexcount Gradle Plugin
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
//Dexcount Gradle Plugin
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.0-SNAPSHOT'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
buildTools = '25.0.2'
compileSdk = 25
minSdk = 23
versionCode = 11
versionName = '4.0'
supportLib = '25.3.1'
playServices = "11.0.0"
}
特征/的build.gradle
buildscript {
repositories {
jcenter()
}
}
apply plugin: 'com.android.feature'
repositories {
jcenter()
mavenCentral()
}
android {
compileSdkVersion rootProject.compileSdk
buildToolsVersion rootProject.buildTools
baseFeature true
defaultConfig {
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.compileSdk
versionCode rootProject.versionCode
versionName rootProject.versionName
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
release {
storeFile file("instantApp_keystore")
storePassword "..."
keyAlias "..."
keyPassword "..."
}
}
buildTypes {
debug {
buildConfigField "String", "PARSE_BACKUP", "\"" + PARSE_BACKUP + "\""
buildConfigField "String", "PARSE", "\"" + PARSE_LIVE + "\""
buildConfigField "String", "PARSE_APP_ID", "\"" + parseAppId_LIVE + "\""
buildConfigField "String", "PARSE_CLIENT_KEY", "\"" + parseClientKey_LIVE + "\""
}
release {
signingConfig signingConfigs.release
buildConfigField "String", "PARSE_BACKUP", "\"" + PARSE_BACKUP + "\""
buildConfigField "String", "PARSE", "\"" + PARSE_LIVE + "\""
buildConfigField "String", "PARSE_APP_ID", "\"" + parseAppId_LIVE + "\""
buildConfigField "String", "PARSE_CLIENT_KEY", "\"" + parseClientKey_LIVE + "\""
}
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
}
dependencies {
compile "com.android.support:appcompat-v7:${rootProject.supportLib}"
compile "com.android.support:design:${rootProject.supportLib}"
compile "com.google.android.gms:play-services-analytics:${rootProject.playServices}"
compile 'com.parse:parse-android:1.14.1'
compile 'com.squareup:otto:1.3.8'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile ('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2'){
exclude module: 'support-v4'
}
compile 'me.relex:circleindicator:1.2.2@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile "com.google.firebase:firebase-crash:${rootProject.playServices}"
}
apply plugin: 'com.google.gms.google-services'
提前致谢!!!! ;)
答案 0 :(得分:2)
不幸的是,Firebase崩溃报告不适用于Instant Apps,也没有计划专门更新它以使用Instant Apps。这是因为Fabric现在是Firebase团队的一部分,Fabric Crashlytics将用于未来的努力。 Firebase docs也提到了这一点。
Crashlytics已经与Instant Apps配合使用,请参阅此帖子以获取有关设置的信息: