Android 库模块开启 isMinifyEnabled=true 时,R8 各自独立混淆, 将内部类重命名为 a.a / a.b 等短名打进 AAR;多个 AAR 合并到 App 时产生 Duplicate class 冲突。 修复:删除全部 7 个库模块 buildTypes.release 中的 isMinifyEnabled, 混淆由 App 的 R8 统一完成。将 proguard-rules.pro 中的保留规则 (manifest 注册类、反射调用入口、dontwarn)合并进各模块的 consumer-rules.pro 随 AAR 打包。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src/main | ||
| build.gradle.kts | ||
| consumer-rules.pro | ||
| proguard-rules.pro | ||
| README.md | ||
sdk-bugcollect
XuqmGroup Android SDK Bug 采集模块。提供错误采集、Crash 捕获、漏斗分析能力。
依赖
implementation("com.xuqm:sdk-bugcollect:VERSION")
implementation("com.xuqm:sdk-core:VERSION") // 必须
快速开始
// Application.onCreate() 中(XuqmSDK.initialize 之后):
BugCollect.setLogLevel(LogLevel.INFO)
BugCollect.setEnvironment("production")
BugCollect.startCrashCapture()
// 业务代码中
BugCollect.event("page_view", mapOf("page" to "home"))
BugCollect.captureError(exception)
API
BugCollect 对象
| API | 说明 |
|---|---|
BugCollect.setLogLevel(level) |
设置日志级别(DEBUG / INFO / WARN / ERROR) |
BugCollect.setEnvironment(env) |
设置环境标签 |
BugCollect.startCrashCapture() |
开启全局 UncaughtExceptionHandler |
BugCollect.event(name, properties?) |
记录自定义事件 |
BugCollect.captureError(error, metadata?) |
上报异常 |
BugCollect.warn(message, metadata?) |
记录警告 |
BugCollect.info(message, metadata?) |
记录信息 |
BugCollect.defineFunnel(id, steps) |
定义漏斗 |
LogLevel
enum class LogLevel { DEBUG, INFO, WARN, ERROR, NONE }
工作原理
- LogQueue:事件进入内存队列,按批次异步上传到
bugCollectApiUrl - CrashCapture:注册
Thread.UncaughtExceptionHandler,捕获 Native Crash 并写入文件,下次启动时上传 - Fingerprint:为错误生成指纹(基于 message + stack),服务端去重聚合
- FunnelTracker:客户端维护漏斗进度,服务端跨 session 聚合
配置
bugCollectApiUrl 和 bugCollectEnabled 由 sdk-core 在 init 后从平台配置自动获取,无需 App 传入。