2014-03-27 59 views
0

從日食LogCat上的按鈕,點擊發送我的應用程序當前事件的日誌通過電子郵件發送應用程序日誌時,獲得空logcat的。使用ACRA點擊一個按鈕

我發現這一點,我們可以通過定義做 -

String logcatArguments[] = { "-t", "100", "-v", "long","ActivityManager:I" ,"*:D","*:S"}; 

但是當我發送按鈕點擊使用ACRA的LOGCAT來了空「」。

如何做到這一點與ACRA?

我把幫助下 -

Sending-reports-for-caught-exceptions-or-for-unexpected-application-state-without-any-exception

我的按鈕實現點擊 -

view.findViewById(R.id.logdone).setOnClickListener(new OnClickListener() { 

@Override 
public void onClick(View v) { 

String logcatArguments[] = { "-t", "100", "-v", "long","ActivityManager:I" ,"*:D","*:S"}; 
ACRAConfiguration config = ACRA.getConfig(); 
config.setMailTo("[email protected]"); 

config.setResToastText(R.string.crash_dialog_ok_toast); 

config.setLogcatArguments(logcatArguments); 

try 
{ 
config.setMode(ReportingInteractionMode.TOAST); 
} 
catch (ACRAConfigurationException e) 
{ 
e.printStackTrace(); 
} 
ACRA.setConfig(config); 

ACRA.getErrorReporter().handleException(null); 

try { 
     config.setMode(ReportingInteractionMode.SILENT); 
    } catch (ACRAConfigurationException e) { 
     e.printStackTrace(); 
    } 

ACRA.setConfig(config); 
} 
}); 

我的應用程序類代碼 -

@ReportsCrashes(formKey = "", 
     mailTo = "[email protected]", 
     customReportContent = { ReportField.USER_CRASH_DATE, ReportField.USER_COMMENT, ReportField.USER_EMAIL, 
     ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.BRAND, ReportField.APP_VERSION_CODE, 
     ReportField.APP_VERSION_NAME, ReportField.STACK_TRACE, ReportField.APPLICATION_LOG, 
     ReportField.LOGCAT 
     }, 
     mode = ReportingInteractionMode.DIALOG, 
     resDialogText = R.string.crash_dialog_text) 


@Override 
    public void onCreate() { 
     super.onCreate(); 

     // The following line triggers the initialization of ACRA 
     ACRA.init(this); 
    } 

回答

0

試圖建立ACRA當我有類似的問題。我的問題是,我沒有包含閱讀登錄Android Manifest的權限。

<uses-permission android:name="android.permission.READ_LOGS"></uses-permission> 

只是雙重檢查。