Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
654 views
in Technique[技术] by (71.8m points)

android - Flutter: FlutterFirebaseInstanceIDService.java uses or overrides a deprecated API

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can try few things:

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

android.useAndroidX=true
android.enableJetifier=true

Changes in file appuild.gradle

android {
    compileSdkVersion 28

...

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

Optionally you can add code inside subproject{} in file androiduild.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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...