close

[Solved] FlutterFirebaseCorePlugin.java uses or overrides a deprecated API

Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app and suddenly I get the following error in my stack track. FlutterFirebaseCorePlugin.java uses or overrides a deprecated API’ in flutter. So today Here I come with all possible solutions for this error.

We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.

How FlutterFirebaseCorePlugin.java uses or overrides a deprecated API Error Occurs ?

When I run my program without importing firebase core, firebase auth and cloud firestore Plugin, and my code runs just fine but I register my app with firebase and it still runs fine but as soon as I import Firebase_authFirebase_core and cloud_Firestore… I get the following error.

Note: C:\milan\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.7.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\milan\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Cannot fit requested classes in a single dex file (# methods: 89543 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
The number of method references in a .dex file cannot exceed 64K.

How To Solve FlutterFirebaseCorePlugin.java uses or overrides a deprecated API Error?

  1. How To Solve FlutterFirebaseCorePlugin.java uses or overrides a deprecated API Error?

    To Solve FlutterFirebaseCorePlugin.java uses or overrides a deprecated API Error First Solution is to update dependencies to their latest version. Just Below Solution 1 Step By Step. If Solution 1 Not worked then Try out our solution 2 Just Change minSdkVersion In your app/build.gradle file, you can set the minSdkVersion inside defaultConfig.

  2. FlutterFirebaseCorePlugin.java uses or overrides a deprecated API

    To Solve FlutterFirebaseCorePlugin.java uses or overrides a deprecated API Error First Solution is to update dependencies to their latest version. Just Below Solution 1 Step By Step. If Solution 1 Not worked then Try out our solution 2 Just Change minSdkVersion In your app/build.gradle file, you can set the minSdkVersion inside defaultConfig.

Solution 1 : update dependencies to theirs latest version

Just update firebase_auth and firebase_core dependencies to theirs latest version.

  1. First, get the latest versions of your dependencies from firebase_auth and firebase_core.
  2. Then run these 3 commands in the terminal.
  3. flutter pub upgrade
  4. then run flutter pub get
  5. flutter clean
  6. And then run your project
  7. flutter run
  8. This will hopefully help you.

Solution 2 : Change minSdkVersion

In your app/build.gradle file, you can set the minSdkVersion inside defaultConfig.

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.name.app"
        minSdkVersion 23    // change this version to 23
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

Solution 3 : Enable multidex in android

Open [project_folder]/app/build.gradle and add following lines.

defaultConfig {
    ...

    multiDexEnabled true
}

and

dependencies {
    ...

    implementation 'com.android.support:multidex:1.0.3'
}
  1. Enable Jetifier.

Open [project_folder]/android/app/gradle.properties and add following lines.

android.useAndroidX=true
android.enableJetifier=true

Solution 4 : replace below line

Note: locationInD\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

The solution I found was to replace this line in android/app/build.gradle:

implementation 'com.google.firebase:firebase-analytics-ktx'

with

implementation 'com.google.firebase:firebase-analytics'

Summery

Check Out Below Article

Leave a Comment

%d bloggers like this: