【AGC】崩溃服务flutter报缺失recordFatalException方法的问题
问题背景:
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。
解决方案:
使用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.
该插件的地址在android studio中是在\flutter\.pub-cache\hosted\pub.flutter-io.cn\agconnect_crash-1.3.0+300\android\build.gradle中,其他ide应该路径也差不多,或者可以全局搜索一下。手动更新一下版本就可以了。
欲了解更多更全技术文章,欢迎访问https://developer.huawei.com/consumer/cn/forum/?ha_source=zzh
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构