1

我正在尝试将源映射上传到 Bugsnag,以便在发生错误时查看完整的堆栈跟踪,而不是捆绑文件的堆栈跟踪。我按照页面上的说明进行操作,但在尝试构建 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"
    }
}

是否缺少将填充此文件的配置选项?

4

1 回答 1

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

然后再试一次

于 2018-06-22T17:59:25.540 回答