1

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?

Frank van Puffelen
603k85 gold badges895 silver badges868 bronze badges
asked Nov 20 at 22:40
New contributor
Mirchen Maibaze is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

1 Answer 1

2

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()

answered Nov 21 at 12:49
Sign up to request clarification or add additional context in comments.

1 Comment

How can I identify which library is pulling the old version and which version should I force?

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.