简体   繁体   English

如何让 Firebase 告诉我用户崩溃的确切代码行?

[英]How do I get Firebase to tell me the exact line of code a user crashed at?

在此处输入图片说明

Look at these crash reports for my android app.查看我的 android 应用程序的这些崩溃报告。 Most of them either give me something useless like it crashed at line 1 or 3, or it gives no line at all.他们中的大多数要么给我一些无用的东西,比如它在第 1 行或第 3 行崩溃,要么根本没有给出任何行。 Is this how Firebase is supposed to work?这是 Firebase 应该如何工作吗?

If you are using Proguard try this workaround:如果您使用 Proguard,请尝试以下解决方法:

There will be a file named proguard-rules.pro in your Gradle Scripts section on Android Studio/ or in app folder of your project in your explorer.在 Android Studio/ 的Gradle 脚本部分或资源管理器中项目的 app 文件夹中,将有一个名为proguard-rules.pro的文件。

In this file uncomment this line:在这个文件中取消注释这一行:

-keepattributes SourceFile,LineNumberTable

This will keep your ClassName and line Number OK.这将使您的 ClassName 和行号保持正常。

If you want to hide your className uncomment this line too.如果你想隐藏你的 className 也取消注释这一行。

-renamesourcefileattribute SourceFile

And also write this line at last最后还写了这一行

-printmapping mapping.txt

This line will generate a mapping.txt file (which you can find in the app folder) to deobfuscate your stack trace when you publish the app in the playstore.这一行将生成一个mapping.txt文件(您可以在 app 文件夹中找到),以便在您在 Playstore 中发布应用程序时对堆栈跟踪进行反混淆处理。

After doing all this, create a new release build of your app and update your existing build.完成所有这些之后,为您的应用程序创建一个新的发布版本并更新您现有的版本。 Your crash report should work fine now.您的崩溃报告现在应该可以正常工作了。

If your app is available in the play store, with the apk you need to upload the generated mapping.txt file also.如果您的应用在 Play 商店中可用,则您还需要使用 apk 上传生成的mapping.txt文件。 (If you are uploading aab file you don't need to upload it) (如果你是上传aab文件就不需要上传)

To upload the mapping file in the new play console follow these steps:要在新的播放控制台中上传映射文件,请执行以下步骤:

  • Go to Release/"App bundle explorer"转到发布/“应用程序包资源管理器”
  • Select the right artifact in the top right corner在右上角选择正确的神器
  • Open Downloads tab打开下载选项卡
  • Scroll to the Assests section滚动到资产部分
  • Next to the "ReTrace mapping file" there should be an upload Button在“ReTrace mapping file”旁边应该有一个上传按钮

This should work.这应该有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在代码中的确切位置将数据从 firebase 提取到 android studio? - How do I pull data from firebase into android studio at the exact point in the code? 我怎么能告诉Java代码运行脚本,因为它是从普通用户的命令行运行的? - How can i tell Java code run the script as it was running from command line as normal user? javamail:我怎么告诉gmail不要签我聊天? - javamail: How do I tell gmail not to sign me into chat? 我如何获得确切的答案? - How do I get an exact answer for this? 如何让FileWatcher告诉我修改后的文件是文件夹? - How can I get FileWatcher to tell me the file modified is a folder? 我已经编写了这段代码,但它确实输出了与 sam 键值对关联的值? 请告诉我如何获得山姆的价值? - I have written this code but it does output the value associated with sam key value pair? please tell me how to get the value of sam? 谁能告诉我这段代码是如何工作的? - Can anyone tell me how is this code working? 如何判断是否已使用 BufferedReader 读入空行? - How do I tell if an empty line has been read in with a BufferedReader? 如何让这行未执行的代码执行? - How do I get this unexecuted line of code to execute? 有人可以告诉我另一种编写此代码行的方式吗? - Can someone tell me a different way of writing this line of code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM