Outline
MSDK integrates Bugly's data reporting function. When the client crashes, it can upload the client information to the server for the developer to view. It can help developers find the online fatal bugs of their apps.
The following picture shows that after the online app crashes, the developer can view the client information through the Bugly platform (Note: Bugly does not report screenshots when an app crashes):
a) Report the stack information of the crashed process, as shown in the following figures: "Malfunctioned thread", "All threads", "System log".
b) Report the basic information of the current mobile phone: device name(vendor, model), system version, disk's available ratio, SD card's available ratio, memory's available ratio and so on.
c) Report the user's openid, as shown in the following picture "User name".
d) User-defined reporting information, as shown in the following figure "More information".
You can define the string reported when the app crashes, as shown below
You can also report binary data when app crashes. With the binary data, you can now find specific crash events at rdm platform -> Exception Reporting Module and download binary data files.
You can upload a small number of user-defined logs about app crash to the Bulgy platform and view it in Extra Data -> User-defined Log
Access Guide
1 Preconditions
1) You have completed initialization according to the initialization module's description initialization
2) Bugly's reporting switch needs to be set in /assets/msdkconfig.ini.
;close bugly's reporting switch, which defaults to false; if the switch is set to true, that means to close the crash reporting function
CLOSE_BUGLY_REPORT=false
3) Obfuscate jar packages according to the agreement
If you do not need to obfuscate jar packages, please ignore this part. If you need to obfuscate jar packages, please do not obfuscate msdk*.jar files, or when you obfuscate msdk*.jar files, please add the following
"keep" information into App's obfuscation configuration:
-keep class * extends android.app.Activity{*;}
-keep class * extends android.app.Service{*;}
#Bugly interface
-keep public class com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler{public *; native <methods>;}
-keep public interface com.tencent.bugly.crashreport.crash.jni.NativeExceptionHandler{*;}
4) Configure App restoration symbol table
Please go to the Bulgy platform to set the restoration symbol table at http://bugly.qq.com/. Refer to symbol table configuration in the Official Website of bugly to complete the configuration.
After completing the above 4 steps, you can view the stack information about the crash of online app.
2 Use crash reporting function
When App crashes, the crash reporting function can report string or binary information to the server for you to analyze it. For details, please see Add the extra business log into the report, Add the extra binary data into the report and Report output log.
View the reported data
Please use the collaborator's account to login the website bugly.qq.com and select the app you want to view, as shown in the figure below, and then view the data reported by bugly. If you do not know the collaborator account, please contact"Flying Eagle Assistant"or"Link to MSDK".
Add the extra business log into the report
1 Summary
When the program crashes, it is sometimes needed to add some additional user-defined data
2 Registration callback
1) Function description
When the program crashes, it is sometimes needed to add some additional user-defined data, which will be reported to the Bugly platform along with the crash log together, so as to better locate the cause of the crash. As shown in the Outline's 3.1 section "Upload an additional string", the reported data can be found in Bugly platform's"user-defined log"->"extra data".
2)Interface declaration
public static void WGSetObserver(WGPlatformObserver observer);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
observer | WGPlatformObserver class | MSDK callback class, please refer to the demo code |
4)Return value
None
5)Demo code
WGPlatform.WGSetObserver(new WGPlatformObserver() {
@Override
public String OnCrashExtMessageNotify() {
// Here the game supplements the additional information reported when crash occurs to help analyze the cause of the crash
String str="test extra crash upload!";
return str;
}
});
6)Special description
The callback may fail when native reporting is made.
7)Term interpretation
None
3 Interface calling
None
Add the extra binary data into the report
1 Summary
When the program crashes, it is sometimes needed to add some additional binary data
2 Registration callback
1) Function description
When the program crashes, it is sometimes needed to add some additional binary data, which will be reported to the Bugly platform along with the crash log together, so as to better locate the cause of the crash. In the end, check the “Error” info at the bugly platform. In terms of binary data, find the specific crash event in “Track Data >Attachment Info”, and download the binary data document.
2)Interface declaration
public static void WGSetObserver(WGPlatformObserver observer);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
observer | WGPlatformObserver class | MSDK callback class, please refer to the demo code |
4)Return value
None
5)Demo code
WGPlatform.WGSetObserver(new WGPlatformObserver() {
@Override
public byte[] OnCrashExtDataNotify() {
return "OnCrashExtDataNotify test crash java".getBytes();
}
});
6)Special description
The callback may fail when native reporting is made.
7)Term interpretation
None
3 Interface calling
None
report Lua/C#/JS script error
1 summary description
When the Lua/C#/JS script of the game is exceptional, the exception messages can be reported to bugly.
2 registration callback
1)function description
Report script exception messages to bugly, perform "error analysis" on bugly -> view the reported information under tab "Lua script error /C# script error/JS script error"
2)interface declaration
void WGReportException(eExceptionType exception_type,
unsigned char *exception_name,
unsigned char *exception_msg,
unsigned char *exception_stack,
std::vector<KVPair> &ext_info)
3)parameter description
name | type | description |
---|---|---|
exception_type | eExceptionType enumeration type | exception type |
exception_name | unsigned char * | exception name |
exception_msg | unsigned char * | exception messages |
exception_stack | unsigned char * | exception stack |
ext_info | vector |
event content, a Dictionary in form of key-value; the maximum length of the key is 64. The maximum length of the value is 1024. The maximum number of keys is 50. For the naming rules of the key, "B1" and "B2" are recommended so as to reduce traffic consumption |
4)Return value
None
5)Demo code
std::vector<KVPair>extInfo;
KVPair item;
item.key="extInfo_Body";
item.value=std::string("wegame_extInfo_body");
eveList.push_back(item);
WGPlatform::GetInstance()->WGReportException((eExceptionType) exceptionType,
"MSDK_excetipon_name",
"MSDK_exception_msg",
"MSDK_exception_stack_test",
extInfo);
6)Special description
None
7)Term interpretation
None
Report output log
1 Summary
Report output log
2 Registration callback
None
3 Interface calling
1) Function description
In some native crash scenarios, event callback functions registered for Bugly, such as OnCrashReportDataEvent and CrashReportDataEvent, may not be performed. It is recommended that you use a user-defined log interface: such an interface can be used to record the debug log that some developers are interested in and can more comprehensively reflect the context before and after App exceptions. Its use mode is consistent with that of android.util.Log. The user passes TAG and log content to the interface. The log will be output in Logcat and reported in the event of an exception. The reported log has a size of up to 30K.
On the bugly webpage, check the custom log reported in "Error Analysis" -> “Custom Error”.
2)Interface declaration
void WGBuglyLog (eBuglyLogLevel level, String log);
3)Parameter description
Parameter name | Parameter type | Description |
---|---|---|
level | enum | For details, seeeBuglyLogLevelsection in the struct description |
log | String | Content to be uploaded (printed) |
4)Return value
None
5)Demo code
WGPlatform.WGBuglyLog(level.val(), "bugly message test");
6)Special description
The user passes TAG and log content to the interface. The log will be output in Logcat and reported in the event of an exception. The reported log has a size of up to 30K.
7)Name interpretation
None
Close Bugly reporting dynamically
1 General description
Close Bugly reporting dynamically. When this interface is called, crash reporting will be closed but other Bugly functions will not be affected; crashes triggered by the restart of the app will be reported normally.
2 Interface call
1) Function description
In some scenarios, apps do not need to report a crash, such as: some apps do not want to report to Bugly crashes triggered during the killing of processes; at this time, they can call this interface to close crash reporting, but other Bugly functions will not be affected; crashes triggered by the restart of the apps will be reported normally.
2) Interface declaration
void WGCloseCrashReport();
3) Parameter description
None
4) Demo code
WGPlatform::GetInstance()->WGCloseCrashReport();
6) Special instructions
After this interface is called to close crash reporting, other Bugly functions will not be affected; crashes triggered by the restart of the app will be reported normally.
7) Term explanation
None