Closed grove86dipesh closed 10 months ago
@grove86dipesh Are there any replicable steps you can provide or minimal code sample that we can use to verify this error ?
I submitted the app to the google play store everything was working fine but after a few weeks getting an app crash issue from firebase. In debug mode, we couldn't be facing any errors. this kind of error getting in the live version after some weeks.
My Main File Code :
Future<void> main() async {
await runZonedGuarded(() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
// options: DefaultFirebaseOptions.currentPlatform,
);
var _firebaseMessaging = FirebaseMessaging.instance;
FlutterError.onError = (errorDetails) {
// If you wish to record a "non-fatal" exception, please use `FirebaseCrashlytics.instance.recordFlutterError` instead
FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails);
};
PlatformDispatcher.instance.onError = (error, stack) {
// If you wish to record a "non-fatal" exception, please remove the "fatal" parameter
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
return true;
};
// 3. On iOS, this helps to take the user permissions
NotificationSettings settings = await _firebaseMessaging.requestPermission(
alert: true,
announcement: false,
badge: true,
carPlay: false,
criticalAlert: false,
provisional: false,
sound: true,
);
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
String? deviceToken = await _firebaseMessaging.getToken();
print("FirebaseMessaging token: $deviceToken");
}
// Set the background messaging handler early on, as a named top-level function
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
FirebaseMessaging.onMessage.listen(_firebaseMessagingBackgroundHandler);
if (!kIsWeb) {
channel = const AndroidNotificationChannel(
'high_importance_channel', // id
'High Importance Notifications', // title
description: 'This channel is used for important notifications.',
// description
importance: Importance.high,
);
flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
/// Create an Android Notification Channel.
///
/// We use this channel in the `AndroidManifest.xml` file to override the
/// default FCM channel to enable heads up notifications.
await flutterLocalNotificationsPlugin!
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.createNotificationChannel(channel!);
/// Update the iOS foreground notification presentation options to allow
/// heads up notifications.
await FirebaseMessaging.instance
.setForegroundNotificationPresentationOptions(
alert: true,
badge: true,
sound: true,
);
}
final NotificationAppLaunchDetails? notificationAppLaunchDetails =
!kIsWeb && Platform.isLinux
? null
: await flutterLocalNotificationsPlugin
?.getNotificationAppLaunchDetails();
if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? false) {
print(
'Giiv open with notification ${notificationAppLaunchDetails!.payload}');
selectedNotificationPayload = notificationAppLaunchDetails.payload;
}
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) {
runApp(Phoenix(child: GiivApp()));
});
}, (error, stackTrace) {
FirebaseCrashlytics.instance.recordError(error, stackTrace);
});
}
Thanks for the update. Using code sample above and running in debug and release mode, I am unable to replicate it. Based on the crash log, I am keeping this issue open for further insights from the team.
/cc @russellwheatley
If you take a look at the error stack trace, it is coming entirely from the Firebase Installations package from the Firebase android SDK. I would suggest opening an issue on their repository to diagnose the issue.
https://github.com/firebase/firebase-android-sdk/issues/3507#issuecomment-1061372855
try this. adding proguard rules.
-keep class com.google.firebase.installations.** { *; }
-keep interface com.google.firebase.installations.** { *; }
Thanks for the update, @ajdll5-dev 👍. Have you tried adding the above, @grove86dipesh?
Hey @grove86dipesh. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
I am continuously getting this kind of error on the google play console.I don't know why this issue is occurring from firebase.
@grove86dipesh did you read the above 2 messages?
Hi guys. We have same issues in our app when we updated our app to new version. Last version firebase Messaging package was 14.1.1 and new version of the app have 14.1.1 Last version of the flutter sdk was 3.3.8 new version of the app generated by using flutter sdk 3.3.10
We didn't have any problem like this before. We didn't update any code parts which is related to the firebase messaging service.
We don't specifiy any R8 related config in our code base. If User delete all app data manually, app is working fine.
Hi guys. We have same issues in our app when we updated our app to new version. Last version firebase Messaging package was 14.1.1 and new version of the app have 14.1.1 Last version of the flutter sdk was 3.3.8 new version of the app generated by using flutter sdk 3.3.10
We didn't have any problem like this before. We didn't update any code parts which is related to the firebase messaging service.
We don't specifiy any R8 related config in our code base. If User delete all app data manually, app is working fine.
Same problem here, crash at every startup when app in downloaded from the store, once cleaned all app data manually it works.
Hello, I'm facing the same problem with an app in production. Even if i got crashlytics from users, I am not able to reproduce the issue with my phone and emulator. Any updates?
Hi, I've encountered the same problem on different apps. I found the problem is related to google backup encryption when updgarding after api 29. For me using:
firebase_core: ^1.4.0
firebase_messaging: ^11.2.6
firebase_crashlytics: ^2.8.1
dependency_overrides:
firebase_core_platform_interface: 4.5.1
with compileSdkVersion 32
and adding:
android:allowBackup="false"
android:fullBackupContent="false"
android:preserveLegacyExternalStorage="true"
android:requestLegacyExternalStorage="true"
in AndroidMaifest.xml at application level, and then flutter clean
, solved the issue.
Unfortunately, I'm unable to get it work with latest firebase packages and compileSdkVersion 33.
I wish it could help someone.
I am getting same problem, no of the findings are helping. It seems to be related to upgrade to Flutter 3.7 for me as it wasn't crashing prior to update.
I am getting same problem, no of the findings are helping. It seems to be related to upgrade to Flutter 3.7 for me as it wasn't crashing prior to update.
Have you tried my solution? I'm with flutter 3.7 too
I am getting same problem, no of the findings are helping. It seems to be related to upgrade to Flutter 3.7 for me as it wasn't crashing prior to update.
Have you tried my solution? I'm with flutter 3.7 too
Yes I did, it does not work for me, as I had these values there for other reasons already.
Hello, When I contacted firebase support, they asked me to download the firebase installation package and re-version and test it. When I asked if they were sure, they just returned as a suggestion. It is not clear that it will definitely solve the problem. Since we can't see the problem without uploading a new version to the play store, we can't test it either. Everything is ok with the downloads made via APK. We encounter this problem when the google play update is released via the bundle. I also opened a ticket to the play store, but I have no hope.
I just ended up rolling back my code to flutter 3.0.5 and everything started working again. I tried with v3.3.10 but no luck. Something else to note is that i confirm what @utkudenis said, that the problem occurs only when downloading from the play store.
Alright I fixed it, what you need to do is add proguard file for android, so here is content of the proguard-rules.pro (put it in the android > app)
-keep class com.google.firebase.installations.** { *; }
-dontwarn com.google.firebase.**
-keep class io.flutter.plugins.firebase.* { *; }
-keep interface com.google.firebase.installations.** {*;}
And then in in same folder edit gradle.build like this:
buildTypes {
release {
signingConfig signingConfigs.release
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Done no crashes even on latest compileSDK, flutter version
Hi @M1chlCZ, What do you think about adding progurard-rules to flutter project? . Flutter does not use any proguard files in default. Did you test it play store production update ?
When we pulled the flutter version to 3.3.7 and downgraded the packages, we solved the problem for a short time, but now we can't trust and update any package. My doubt is whether this issue has anything to do with sentry. Braking changes were an update to a single sentry package. 6.16.0 to 6.18.3
I got a response from google play support about the source of this problem that they couldn't solve it and couldn't determine the cause.
edit : spelling
Hi @M1chlCZ, What do you think about adding progurard-rules to flutter project? . Flutter does not use any proguard files in default. Did you test it play store production update ?
When we pulled the flutter version to 3.3.7 and downloaded the packages, we solved the problem for a short time, but now we can't trust and update any package. My doubt is whether this issue has anything to do with sentry. Braking changes were an update to a single sentry package. 6.16.0 to 6.18.3
I got a response from google play support about the source of this problem that they couldn't solve it and couldn't determine the cause.
I am running it for around 10 days on Google Play and there is no longer any issues (if there would be a problems, it would now be in thousands), so I would say this fixed it. To be clear, I have never used proguard, it is just what i gathered on the internet. I've tried it out of the desperation and it worked.
If you add firebase_app_installation package to your project you can see the crash on the internal test :)
proguard file cannot solve my problem because live streaming and other features crashesh if ı use proguard settings
Any updates on this? My app suddenly had a lot of crash in firebase...
`
firebase_core: ^2.11.0 firebase_dynamic_links: ^5.0.1 firebase_in_app_messaging: ^0.7.1+1 firebase_messaging: ^14.4.1 firebase_crashlytics: ^3.3.1 firebase_analytics: ^10.0.1 firebase_performance: ^0.9.1+1 `
Hi guys.
We have same issues in our app when we updated our app to new version.
Last version firebase Messaging package was 14.1.1 and new version of the app have 14.1.1
Last version of the flutter sdk was 3.3.8 new version of the app generated by using flutter sdk 3.3.10
We didn't have any problem like this before. We didn't update any code parts which is related to the firebase messaging service.
We don't specifiy any R8 related config in our code base.
If User delete all app data manually, app is working fine.
any updates on this ?
Any updates on this? My app suddenly had a lot of crash in firebase...
`
firebase_core: ^2.11.0 firebase_dynamic_links: ^5.0.1 firebase_in_app_messaging: ^0.7.1+1 firebase_messaging: ^14.4.1 firebase_crashlytics: ^3.3.1 firebase_analytics: ^10.0.1 firebase_performance: ^0.9.1+1 `
We fixed this issue by removing the BOM in the app's Gradle file. Maybe it will work for everyone.
It's a problem with flutter + firebase + obfuscation, turn off proguard or disable obfuscation work for me.
I am having the same issue in my live and app is working fine on debug mode
here the logs i get from crashlytics
Fatal Exception: java.lang.AbstractMethodError: abstract method "b.a b.a.v(int)"
at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.readGenerateAuthTokenResponse(FirebaseInstallationServiceClient.java:90)
at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.b(FirebaseInstallationServiceClient.java:96)
at com.google.firebase.installations.FirebaseInstallations.fetchAuthTokenFromServer(FirebaseInstallations.java:29)
at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:68)
at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$3(FirebaseInstallations.java:68)
at com.google.firebase.concurrent.SequentialExecutor$1.run(SequentialExecutor.java:2)
at com.google.firebase.concurrent.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:84)
at com.google.firebase.concurrent.SequentialExecutor$QueueWorker.run(SequentialExecutor.java)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:13)
at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(R8$$SyntheticClass:13)
at java.lang.Thread.run(Thread.java:1012)
My flutter sdk version is 3.13.3
and
firebase_core: ^2.15.1
firebase_crashlytics: ^3.3.5
firebase_messaging: ^14.6.7
Any updates on this? Debug mode works fine but on live mode (from Play Store) not
This issue isn't specific to FlutterFire, it seems possibly related to caching or obfuscation. Ultimately, the stack trace is clearly coming from Firebase android SDK. To summarise some of the fixes that have helped, folks, try the following:
FYI; This issue was opened on the Firebase android SDK and was resolved by the user using proguard config: https://github.com/firebase/firebase-android-sdk/issues/3507#issuecomment-1061372855
I am facing the above issue on the live app.
pubspec.yaml :
firebase_core: ^2.1.0 firebase_messaging: ^14.0.2 firebase_analytics: ^10.0.2 firebase_crashlytics: ^3.0.2
Process finished with exit code 0