我正在尝试将源映射上传到Bugsnag,以便在发生错误时查看完整的堆栈跟踪,而不是捆绑文件的堆栈跟踪。我按照this页面上的说明操作,但在尝试构建APK时出现此错误:
> Task :app:uploadBugsnagReleaseMapping
Mapping file not found: null
我查看了我的android\app\build.gradle
文件,发现minifiedEnabled
属性设置为false。我将其更改为true,然后将错误更改为:
Mapping file not found: C:\Development\React Native Practise\bugsnag_practise\android\app\build\outputs\mapping\release\mapping.txt
我以为我需要手动添加文件,所以我在该目录中添加了一个带有该名称的空文本文件,并得到了这个:
Attempting upload of mapping file to Bugsnag
Bugsnag upload failed with code 422: Received empty file
Retrying Bugsnag upload (1/5) ...
Attempting upload of mapping file to Bugsnag
Bugsnag upload failed with code 422: Received empty file
Retrying Bugsnag upload (2/5) ...
Attempting upload of mapping file to Bugsnag
Bugsnag upload failed with code 422: Received empty file
Retrying Bugsnag upload (3/5) ...
Attempting upload of mapping file to Bugsnag
Bugsnag upload failed with code 422: Received empty file
Retrying Bugsnag upload (4/5) ...
Attempting upload of mapping file to Bugsnag
Bugsnag upload failed with code 422: Received empty file
Retrying Bugsnag upload (5/5) ...
Attempting upload of mapping file to Bugsnag
Bugsnag upload failed with code 422: Received empty file
如果有帮助,这是android\app\build.gradle
中的错误配置:
bugsnag {
autoUpload true
ndk false
autoReportBuilds true
autoProguardConfig true
overwrite true
retryCount 5
}
和我的buildTypes配置在同一个文件中:
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
是否缺少填充此文件的配置选项?
答案 0 :(得分:2)
您需要在app/proguard-rules.pro
中禁用混淆
# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
# Disable to generate mapping.txt Enable for production apk
-dontobfuscate <- Comment this line
然后重试