My Flutter app is crashing on startup with NoSuchMethodError when Firebase tries to initialize. The method checkNotGoogleApiHandlerThread() is not found in the Preconditions class, causing a FATAL EXCEPTION that terminates the app.
Error Log:
E/AndroidRuntime(1062): FATAL EXCEPTION: Firebase Blocking Thread #1
E/AndroidRuntime(1062): Process: com.xawalla.app, PID: 1062
E/AndroidRuntime(1062): java.lang.NoSuchMethodError: No static method checkNotGoogleApiHandlerThread()V in class Lcom/google/android/gms/common/internal/Preconditions; or its super classes (declaration of 'com.google.android.gms.common.internal.Preconditions' appears in /data/app/~~bqQsV4kN6IF_8w66umxitQ==/com.xawalla.app-Qw5hjYN7VtKv3uCS0zR9OQ==/base.apk)
E/AndroidRuntime(1062): at com.google.android.gms.tasks.Tasks.await(com.google.android.gms:play-services-tasks@@18.1.0:2)
E/AndroidRuntime(1062): at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.openHttpURLConnection(FirebaseInstallationServiceClient.java:487)
Configuration
android/app/build.gradle:
gradle
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id 'com.google.gms.google-services'
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation platform('com.google.firebase:firebase-bom:32.7.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-auth'
}
android/build.gradle:
gradle
buildscript {
ext.kotlin_version = '1.8.22'
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.4.0'
}
}
The crash occurs during Firebase initialization
Specifically in Firebase Blocking Thread #1 and Firebase Blocking Thread #0.
The missing method belongs to play-services-tasks@@18.1.0
I've already tried to update Kotlin to 1.8.22; use Firebase BOM 32.7.0; force specific Play Services version, complete cleanup (flutter clean, gradle clean).
Environment:
Flutter 3.19.+
Android minSdkVersion 23
Android x86_64 emulator
Google Services 4.4.0
How to resolve this Google Play Services version conflict that's causing the NoSuchMethodError in Firebase Crashlytics without removing Crashlytics from the project?
1 Answer 1
This crash happens because one of your Firebase/Play-Services libraries is pulling in an old version of com.google.android.gms:play-services-basement, and that older version does not contain the method:
Preconditions.checkNotGoogleApiHandlerThread()
1 Comment
Explore related questions
See similar questions with these tags.