Flutter:FlutterFirebaseInstanceIDService.java使用或覆盖不推荐使用的API [英] Flutter: FlutterFirebaseInstanceIDService.java uses or overrides a deprecated API

查看:154
本文介绍了Flutter:FlutterFirebaseInstanceIDService.java使用或覆盖不推荐使用的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Firebase消息传递服务集成到flutter应用程序中,并在flutter中使用最新的firebase_messaging:^3.0.0 gradle,但是在安装显示错误的应用程序时,我已经多次重新安装了该应用程序.

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.

我在android部分的build.gradle中添加了这些行,仍然显示相同的错误.我已经拿了裁判.来自此处.

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"
        }
    }

如何解决此错误-Xlint:deprecation抖动.

推荐答案

您可以尝试一些尝试:

将这些行粘贴到gradle.properties文件的末尾.

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

android.useAndroidX=true
android.enableJetifier=true

文件app\build.gradle

android {
    compileSdkVersion 28

...

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

(可选)您可以在文件android\build.gradle

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

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

转到终端并启动命令

flutter clean

再次构建应用.

这篇关于Flutter:FlutterFirebaseInstanceIDService.java使用或覆盖不推荐使用的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆