1、在https://bugly.qq.com/v2/upgrade/创建应用

此处注意:策略启动条件设置为立即启动。
2、buid.gradle配置
android {
defaultConfig {
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86_64"
}
}
}
dependencies {
// 其中latest.release指代最新版本号,也可以指定明确的版本号,例如1.2.7
// (注:从2.1.5开始要分开Bugly SDK和NDK的配置)
//注释掉原有bugly的仓库
implementation 'com.tencent.bugly:crashreport_upgrade:latest.release'
implementation 'com.tencent.bugly:nativecrashreport:latest.release'
}
3、AndroidMainfest.xml配置
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<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" />
<uses-permission android:name="android.permission.READ_LOGS" />
<activity
android:name="com.tencent.bugly.beta.ui.BetaActivity"
android:theme="@android:style/Theme.Translucent" />
4、在Application内初始化。
/**
* Context context, 上下文
* String appId, buglg注册的appId
* boolean isDebug 是否开启debug模式,true为是
*/
Bugly.init(getApplicationContext(), Constants.BUGLY_ID, true);
5、添加混淆
-dontwarn com.tencent.bugly.**
-keep public class com.tencent.bugly.**{*;}
-keep class android.support.**{*;}

SDK初始化
注意:如果您之前使用过Bugly SDK,请将以下这句注释掉。
CrashReport.initCrashReport(getApplicationContext(), Constants.BUGLY_ID, false);
统一初始化方法:
Bugly.init(getApplicationContext(), Constants.BUGLY_ID, true);
高级配置请参考
https://blog.csdn.net/qq_37417065/article/details/79898274
bugly异常统计:



网友评论