facundomedica / fast_qr_reader_view

A Fast QR Reader widget for Flutter. For both Android and iOS
MIT License
295 stars 163 forks source link

Exception: FirebaseApp is not initialized #18

Closed rmkubala closed 5 years ago

rmkubala commented 5 years ago

Hello, I have an issue with the initialization of the plugin. I receive the following exception when I call

_controller.initialize()

Here is the Exception

QRReaderException(error, Default FirebaseApp is not initialized in this process eu.ekinnolab.navipay.navipayflutter. Make sure to call FirebaseApp.initializeApp(Context) first.)

There is no information about calling this init method on the Android side.

Here is the full stacktrace:

E/MethodChannel#fast_qr_reader_view(23961): Failed to handle method call E/MethodChannel#fast_qr_reader_view(23961): java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process eu.ekinnolab.navipay.navipayflutter. Make sure to call FirebaseApp.initializeApp(Context) first. E/MethodChannel#fast_qr_reader_view(23961): at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.0.2:240) E/MethodChannel#fast_qr_reader_view(23961): at com.google.firebase.ml.vision.FirebaseVision.getInstance(Unknown Source:1) E/MethodChannel#fast_qr_reader_view(23961): at co.apperto.fastqrreaderview.java.barcodescanning.BarcodeScanningProcessor.<init>(BarcodeScanningProcessor.java:55) E/MethodChannel#fast_qr_reader_view(23961): at co.apperto.fastqrreaderview.FastQrReaderViewPlugin$QrReader.open(FastQrReaderViewPlugin.java:570) E/MethodChannel#fast_qr_reader_view(23961): at co.apperto.fastqrreaderview.FastQrReaderViewPlugin$QrReader.access$1400(FastQrReaderViewPlugin.java:342) E/MethodChannel#fast_qr_reader_view(23961): at co.apperto.fastqrreaderview.FastQrReaderViewPlugin$QrReader$1.run(FastQrReaderViewPlugin.java:471) E/MethodChannel#fast_qr_reader_view(23961): at co.apperto.fastqrreaderview.FastQrReaderViewPlugin$QrReader.<init>(FastQrReaderViewPlugin.java:476) E/MethodChannel#fast_qr_reader_view(23961): at co.apperto.fastqrreaderview.FastQrReaderViewPlugin.onMethodCall(FastQrReaderViewPlugin.java:213) E/MethodChannel#fast_qr_reader_view(23961): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200) E/MethodChannel#fast_qr_reader_view(23961): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163) E/MethodChannel#fast_qr_reader_view(23961): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#fast_qr_reader_view(23961): at android.os.MessageQueue.next(MessageQueue.java:325) E/MethodChannel#fast_qr_reader_view(23961): at android.os.Looper.loop(Looper.java:142) E/MethodChannel#fast_qr_reader_view(23961): at android.app.ActivityThread.main(ActivityThread.java:6494) E/MethodChannel#fast_qr_reader_view(23961): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#fast_qr_reader_view(23961): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) E/MethodChannel#fast_qr_reader_view(23961): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

sulo61 commented 5 years ago

Same issue here, I did everything like in documentation, copied example from repo, added FirebaseApp.initializeApp(Context) - still not working

bpillon commented 5 years ago

I had this error too when I did not completly initialized Firebase for my project :

In your IDE or editor, open android/app/build.gradle, then add the following line as the last line in the file: apply plugin: 'com.google.gms.google-services'

and

Open android/build.gradle, then inside the buildscript tag, add a new dependency:


buildscript {
   repositories {
       // ...
   }

   dependencies {
       // ...
       classpath 'com.google.gms:google-services:3.2.1'   // new
   }
}
AmandaMML commented 5 years ago

Any solution for this?

victormungai97 commented 5 years ago

You have to add android app to your firebase project and download the google services json file for the error to clear and the app to function properly. I did that and it worked

facundomedica commented 5 years ago

This seems to be a problem with the (missing) installation of Firebase which is needed and is stated in the readme: Add Firebase to your project following this step (only that step, not the entire guide). Closing.

ghost commented 3 years ago

Here's what worked for me:

dependencies {

   //....

    implementation 'com.android.support:multidex:1.0.3'

    implementation 'com.google.firebase:firebase-analytics:17.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-auth:17.0.0'

}

apply plugin: 'com.google.gms.google-services'