Bugly Android SDK User Guide
Preparation before access
Library file import
Automatic integration (recommended)
Integration SDK
android { defaultConfig { ndk { //Set the supported SO library architecture abiFilters 'armeabi' //, 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a' } } } dependencies { Implementation 'com. test. bug: crash report: latest. release'//where latest. release refers to the latest bug SDK version number, or you can specify a specific version number, such as 4.0.3 }
Implementation 'com. tencent. rqd: nativecrashreport: latest. release'//where latest. release refers to the latest Bugly NDK version number, or you can specify a specific version number, such as 3.9.2
Note: Bugly SO library will be automatically included during automatic integration. It is recommended to use the "abiFilter" configuration of NDK in the build.gradle file of the module to set the supported SO library architecture.
If adding “abiFilter” Then the following prompt appears in Android Studio:
NDK integration is deprecated in the current plugin. Consider trying the new experimental plugin.
In the project root directory gradle.properties Add:
android.useDeprecatedNdk=true
Manual integration (not recommended)
-
Download Bugly's Android SDK package ;
-
Copy the aar file to the libs directory of the module, and add dependencies in the gradle file of the module:
dependencies { implementation files('libs/Bugly_sdk.aar') }
-
Pure Java code project: just configure the Mapping file generated after confusion; -
Projects containing native code: It is recommended to configure symbol table files extracted from Debug SO by symbol table tools.
Parameter configuration
-
Add permissions in AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-
To avoid confusing Bugly, add the following configurations to the Proguard confusion file:
-dontwarn com.tencent.bugly.** -keep public class com.tencent.bugly.**{*;}
The simplest initialization
Please make sure that you have upgraded the Bugly SDK to the latest version that meets the new regulatory regulations
Please be sure to initialize the Bugly SDK after the user authorizes the Privacy Policy
CrashReport. initCrashReport (getApplicationContext(), "APPID applied during registration", false);
To ensure the accuracy of operation data, it is recommended not to initialize Bugly in asynchronous threads.
The third parameter is the SDK debug mode switch. The behavior characteristics of the debug mode are as follows:
Output detailed Bugly SDK logs; Every crash will be reported immediately; Custom logs will be output in Logcat.
It is recommended to set it to true during testing and false during publishing.
<application <!-- Configure APP ID --> <meta-data android:name="BUGLY_APPID" android:value="<APP_ID>" /> <!-- Configure the APP version number --> <meta-data android:name="BUGLY_APP_VERSION" android:value="<APP_Version>" /> <!-- Configure APP channel number --> <meta-data android:name="BUGLY_APP_CHANNEL" android:value="<APP_Channel>" /> <!-- Configure the Bugly debug mode (true or false) --> <meta-data android:name="BUGLY_ENABLE_DEBUG" android:value="<isDebug>" /> </application>
CrashReport.initCrashReport(getApplicationContext());
Compliance problem handling
-
The latest version of SDK will not obtain the unique ID of the device In order to make the crash rate statistics more accurate, it is recommended that the business set its own unique ID to the SDK, as shown in Advanced Features -Set device id -
The latest SDK will not get the phone model by default If necessary, please set the phone model to the SDK after obtaining the phone model in compliance, see Advanced Features -Set device model
MultiDex Considerations
public class MyApplication extends SomeOtherApplication { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(context); Multidex.install(this); } }
Test and Demo
CrashReport.testJavaCrash();