注释参数必须是编译时常量acra android
我正在尝试向我的应用程序添加acra支持,以便在应用程序崩溃时发送报告。我上了一节课:注释参数必须是编译时常量acra android,android,kotlin,Android,Kotlin,我正在尝试向我的应用程序添加acra支持,以便在应用程序崩溃时发送报告。我上了一节课: @ReportsCrashes(formUri = "", mailTo = "****@gmail.com", mode = ReportingInteractionMode.TOAST, customReportContent = Array<ReportField>(5) { i: Int -> ReportField.ANDROID_V
@ReportsCrashes(formUri = "",
mailTo = "****@gmail.com",
mode = ReportingInteractionMode.TOAST,
customReportContent = Array<ReportField>(5) { i: Int -> ReportField.ANDROID_VERSION },
resToastText = R.string.crash_toast_text)
class AcraReports : Application() {
override fun onCreate() {
super.onCreate()
ACRA.init(this)
}
}
但此代码不起作用:(我做错了什么,以及如何将此信息添加到我的消息?我不知道您在数组(5)背后的意图,但此代码起作用,您应该能够从中详细说明:
@ReportsCrashes(
formUri = "",
formKey = "the key",
mailTo = "****@gmail.com",
mode = ReportingInteractionMode.TOAST,
customReportContent = [ReportField.ANDROID_VERSION],
resToastText = R.string.crash_toast_text
)
但它不会向我发送任何数据,我会像android版本或smth那样发送:(
customReportContent = { /* */ReportField.APP_VERSION_NAME, ReportField.PACKAGE_NAME,ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,ReportField.LOGCAT },
@ReportsCrashes(
formUri = "",
formKey = "the key",
mailTo = "****@gmail.com",
mode = ReportingInteractionMode.TOAST,
customReportContent = [ReportField.ANDROID_VERSION],
resToastText = R.string.crash_toast_text
)