gpt4 book ai didi

android - FirebaseCrash 不适用于 InstantApps

转载 作者:行者123 更新时间:2023-11-29 19:12:12 25 4
gpt4 key购买 nike

我正在实现和添加 FirebaseCrash 的 InstantApp。

我按照所有步骤进行设置,当我使用可安装版本的构建配置运行应用程序时,它就像一个魅力,但当我尝试运行 InstantApp 的构建配置时,FirebaseCrash 使应用程序崩溃。

在我模拟崩溃的这一行中应用程序崩溃只是为了检查它是否有效:

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"
}

features/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'

提前致谢!!!! ;)

最佳答案

不幸的是,Firebase 崩溃报告不适用于 Instant Apps,也没有计划专门更新它以与 Instant Apps 一起使用。这是因为 Fabric 现在是 Firebase 团队的一部分,Fabric Crashlytics 是 future 的工作重点。 Firebase docs也提一下这个。

Crashlytics 已经可以与 Instant Apps 一起使用,请参阅此帖子以获取有关设置它的信息:

How do I integrate Crashlytics with Android Instant Apps?

关于android - FirebaseCrash 不适用于 InstantApps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44947142/

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