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
  • 7,524
  • 26
  • 65
  • 105

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
  • 48,256
  • 14
  • 136
  • 105
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
  • 3,885
  • 3
  • 21
  • 37