MD. HASAN MUNSI
MD. HASAN MUNSI

Reputation: 43

Facing error while trying to add Firebase on Flutter project

I am getting error whenever adding implementation 'com.google.firebase:firebase-analytics:17.2.2' and apply plugin: 'com.google.gms.google-services' into app>build.gradle, along with classpath 'com.google.gms:google-services:4.3.3' into android>build.gradle. If I do not use this three things, app is working fine. What am I missing?

This is the error I am getting

Launching lib\main.dart on Android SDK built for x86 in debug mode...
[!] Your app isn't using AndroidX.
    To avoid potential build failures, you can quickly migrate your app by following the steps on.
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\HASAN\Mobile_App_Projects\bangla_jokes\android\app\build.gradle' line: 24

* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 1s
Finished with error: Gradle task assembleDebug failed with exit code 1

Flutter doctor screenshot enter image description here

After updating licenses flutter doctor enter image description here

Also, Why is this things always red. app>build.gradle enter image description here

Upvotes: 1

Views: 350

Answers (1)

Peter Haddad
Peter Haddad

Reputation: 80924

You need to migrate to androidx. Check here:

https://flutter.dev/docs/development/androidx-migration

to know how to migrate the application to androidX.

Alternatively, you can update flutter to the latest version and create a new project that will automatically use androidx. You can update by executing the following command:

flutter upgrade

Upvotes: 0

Related Questions