| انتخاب پلتفرم: | iOS+ اندروید فلاتر یونیتی |
The Crashlytics Gradle plugin can automatically detect when you obfuscate your code. When your build generates a mapping file, the plugin uploads it so the Crashlytics servers can use the file to render your app's stack traces as unobfuscated and human-readable code.
پیکربندیهای مورد نیاز هنگام استفاده از R8، ProGuard و DexGuard
Crashlytics میتواند با هر فایل نگاشت سازگار با ProGuard از حالت مبهم خارج شود و علاوه بر این با ProGuard، R8 و DexGuard نیز آزمایش شده است.
If your app uses R8 with obfuscation turned on along with Android Gradle 4.2.0+, Crashlytics will produce readable crash reports. Note that Crashlytics recently improved support for apps that use both Kotlin and R8, which can lead to some unexpected issue labeling .
If your app uses the ProGuard config file, you need to preserve the information Crashlytics requires for producing readable crash reports. Do this by adding the following lines to your ProGuard or DexGuard config file:
-keepattributes SourceFile,LineNumberTable # Keep file names and line numbers. -keep public class * extends java.lang.Exception # Optional: Keep custom exceptions.
To get help for questions or issues related to DexGuard, contact the Guardsquare support team directly. For help with ProGuard, visit the Guardsquare Community forums to get assistance from an expert.
نسخههای ساخت مبهمسازیشده را نگه دارید
برای جلوگیری از آپلود فایل نگاشت توسط افزونه Crashlytics Gradle برای نسخههایی که از مبهمسازی استفاده میکنند، ویژگی افزونه firebaseCrashlytics.mappingFileUploadEnabled Gradle را در فایل Gradle ماژول (سطح برنامه) خود (معمولاً <project>/<app-module>/build.gradle.kts یا <project>/<app-module>/build.gradle ) روی false تنظیم کنید. این میتواند به افزایش سرعت زمان ساخت برای ساختهای مبهمسازی شده کمک کند، اما توجه داشته باشید که ردپاهای پشته حاصل در صفحه Crashlytics کنسول Firebase به صورت مبهمسازی شده ظاهر میشوند.
Kotlin
import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension // ... android { // To enable Crashlytics mapping file upload for specific build types: buildTypes { getByName("debug") { minifyEnabled = true configure<CrashlyticsExtension> { mappingFileUploadEnabled = false } } } ... // To enable Crashlytics mapping file upload for specific product flavors: flavorDimensions += "environment" productFlavors { create("staging") { dimension = "environment" ... configure<CrashlyticsExtension> { mappingFileUploadEnabled = false } } create("prod") { dimension = "environment" ... configure<CrashlyticsExtension> { mappingFileUploadEnabled = true } } } }
Groovy
android { // To enable Crashlytics mapping file upload for specific build types: buildTypes { debug { minifyEnabled true firebaseCrashlytics { mappingFileUploadEnabled false } } } ... // To enable Crashlytics mapping file upload for specific product flavors: flavorDimensions "environment" productFlavors { staging { dimension "environment" ... firebaseCrashlytics { mappingFileUploadEnabled false } } prod { dimension "environment" ... firebaseCrashlytics { mappingFileUploadEnabled true } } } }