Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
注释参数必须是编译时常量acra android_Android_Kotlin - Fatal编程技术网

注释参数必须是编译时常量acra android

注释参数必须是编译时常量acra android,android,kotlin,Android,Kotlin,我正在尝试向我的应用程序添加acra支持,以便在应用程序崩溃时发送报告。我上了一节课: @ReportsCrashes(formUri = "", mailTo = "****@gmail.com", mode = ReportingInteractionMode.TOAST, customReportContent = Array<ReportField>(5) { i: Int -> ReportField.ANDROID_V

我正在尝试向我的应用程序添加acra支持,以便在应用程序崩溃时发送报告。我上了一节课:

@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
)