默认情况下,ACRA只填充两个字段,基本上是内存转储和堆栈跟踪。 我试图让ACRA返回APP_VERSION,ANDROID_VERSION,PHONE_MODEL等字段,但在ACRA的最新版本中,我找不到ReportField。*下面是文档中显示的内容,但它没有为我编译。
import static ReportField.*;
@ReportsCrashes(formKey = "xxxxxxxxxxxxxxxx",
customReportContent = { APP_VERSION, ANDROID_VERSION, PHONE_MODEL, CUSTOM_DATA, STACK_TRACE, LOGCAT },
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text
public class MyApplication extends Application {
答案 0 :(得分:1)
org.acra.ReportField确实存在于acra jar文件中。但是在Android 4.0中,JDK 1.6
行:
import static ReportField。*;不编译。
应该是:
import static org.acra.ReportField.*;
答案 1 :(得分:0)
这是来自acra版本4.4.0的所有字段 但要记住!!配置acra错误的90%在谷歌文档表格
试试这个:
import org.acra.ACRA;
import org.acra.ReportField;
import org.acra.annotation.ReportsCrashes;
import android.app.Application;
import android.content.Context;
@ReportsCrashes(formKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", customReportContent = {ReportField.APP_VERSION_CODE, ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA,
ReportField.STACK_TRACE, ReportField.LOGCAT, ReportField.AVAILABLE_MEM_SIZE, ReportField.REPORT_ID, ReportField.APPLICATION_LOG, ReportField.PACKAGE_NAME, ReportField.FILE_PATH,
ReportField.BUILD, ReportField.BRAND, ReportField.PRODUCT, ReportField.TOTAL_MEM_SIZE, ReportField.INITIAL_CONFIGURATION, ReportField.CRASH_CONFIGURATION, ReportField.DISPLAY,
ReportField.USER_COMMENT, ReportField.USER_APP_START_DATE, ReportField.USER_CRASH_DATE, ReportField.DUMPSYS_MEMINFO, ReportField.EVENTSLOG, ReportField.RADIOLOG, ReportField.IS_SILENT,
ReportField.DEVICE_ID, ReportField.INSTALLATION_ID, ReportField.DEVICE_FEATURES, ReportField.ENVIRONMENT, ReportField.SETTINGS_SYSTEM, ReportField.SETTINGS_SECURE,
ReportField.SHARED_PREFERENCES, ReportField.MEDIA_CODEC_LIST, ReportField.THREAD_DETAILS})
public class XYZApplication extends Application {
public void onCreate() {
ACRA.init(this);
super.onCreate();
}
}