2

Integrating Firebase messaging service in flutter app and using latest firebase_messaging:^3.0.0 gradle in the flutter but while installing app showing error and I have already reinstall the app many times.

FlutterFirebaseInstanceIDService.java:21: error: cannot find symbol
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
FlutterFirebaseInstanceIDService.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

I have added these line in build.gradle in the android section, still showing the same error. I have taken ref. from here.

gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:deprecation"
        }
    }

How to resolve this error -Xlint:deprecation for flutter.

Farhana Naaz Ansari
  • 8,382
  • 15
  • 63
  • 97

2 Answers2

6

You can try few things:

Paste these lines at the end of gradle.properties file.

android.useAndroidX=true
android.enableJetifier=true

Changes in file app\build.gradle

android {
    compileSdkVersion 28

...

defaultConfig {
    minSdkVersion 21
    targetSdkVersion 28
    multiDexEnabled true
    ...
}

Optionally you can add code inside subproject{} in file android\build.gradle

subprojects {
    ...
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
        }
    }
}

Go to terminal and launch command

flutter clean

Build the App Again.

anmol.majhail
  • 32,558
  • 8
  • 95
  • 93
0

in your android/app/build.gradle file set the minSdkVersion 21

or

add this implementation "androidx.multidex:multidex:2.0.0" in your dependencies at android/app/build.gradle file

ayoub boumzebra
  • 883
  • 1
  • 10
  • 21