gpt4 book ai didi

android - Firebase crashlytics 仍然悬而未决

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

我想在 firebase crashlytics 中跟踪 Android/IOS 的 flutter 崩溃,但在跟踪应用程序的第一次崩溃时出现问题,它仍在监听第一次崩溃。

在 pubspec.yaml 中

firebase_crashlytics:
firebase_analytics:
firebase_core: ^1.7.0

在应用程序 build.gradle 中

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'io.fabric'

在 build.gradle 中

buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}

dependencies {
classpath 'com.google.gms:google-services:4.3.0'
classpath 'io.fabric.tools:gradle:1.26.1'
classpath 'com.android.tools.build:gradle:4.1.0'
}
}

在 flutter main.dart 中:

WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
await FirebaseCrashlytics.instance
.setCrashlyticsCollectionEnabled(true);
FirebaseCrashlytics.instance.setUserIdentifier("51");
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
FirebaseCrashlytics.instance.crash();

我什至尝试过 android native 示例崩溃 throw new RuntimeExeption("test Firebase crash");但 firebase 仍在监听第一次应用程序崩溃。

更新

Firebase Crashlytics 页面在 48 小时后就像下面这样

pending image

最佳答案

我认为您可以在代码中使用这一行。因为这一行,我认为您无法获得崩溃报告。我面临着同样的问题..下面的代码工作得很好

implementation 'com.google.firebase:firebase-crashlytics:17.3.1'

use this code in app.build.gradle

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.billingclient:billing:3.0.2'
implementation platform('com.google.firebase:firebase-bom:29.0.4')
implementation 'com.google.firebase:firebase-analytics'
}
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.gms.google-services'

in Android.build.gradle

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath 'com.google.gms:google-services:4.3.5'
}

in you main.dart use this code

Future main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();

FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
runApp(
MyApp(),
);
}

and I put this line to crash the app in Splash init function .you canuse this line where you find suitable

FirebaseCrashlytics.instance.crash();

关于android - Firebase crashlytics 仍然悬而未决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69706527/

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