zl程序教程

您现在的位置是:首页 >  后端

当前栏目

【AGC】崩溃服务flutter报缺失recordFatalException方法的问题

方法flutter服务 崩溃 缺失 AGC 问题
2023-09-11 14:20:22 时间

 问题背景:

cp反馈集成AGC-崩溃服务的flutter插件,使用最新的1.3.0+300版本,出现下面错误

/Users/yin/Documents/projects/flutter/.pub-cache/hosted/pub.dartlang.org/agconnect_crash-1.3.0+300/android/src/main/java/com/huawei/agconnectcrash/AGConnectCrashPlugin.java:106: 错误: 找不到符号

AGConnectCrash.getInstance().recordFatalException(exception);

               ^

符号: 方法 recordFatalException(FlutterError)

位置: 类 AGConnectCrash

注: /Users/yin/Documents/projects/flutter/.pub-cache/hosted/pub.dartlang.org/agconnect_crash-1.3.0+300/android/src/main/java/com/huawei/agconnectcrash/AGConnectCrashPlugin.java使用或覆盖了已过时的 API。

注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。

1 个错误

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':agconnect_crash:compileDebugJavaWithJavac'.

> Compilation failed; see the compiler error output for details.

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 18s

Exception: Gradle task assembleDebug failed with exit code 1

Exited。

cke_1897.png

解决方案:

使用AGC-崩溃服务flutte引入的crash sdk会自动引入安卓的crash这个库。但是目前最新的flutter1.3.0中,引入的安卓的库还是1.7.1.300没有自动更新,而record这个方法是在1.7.2.300中才加入的,所以需要cp手动将版本更新到1.7.2.300或1.7.3.300.

cke_4193.png

该插件的地址在android studio中是在\flutter\.pub-cache\hosted\pub.flutter-io.cn\agconnect_crash-1.3.0+300\android\build.gradle中,其他ide应该路径也差不多,或者可以全局搜索一下。手动更新一下版本就可以了。

cke_6854.png

欲了解更多更全技术文章,欢迎访问https://developer.huawei.com/consumer/cn/forum/?ha_source=zzh