2014-09-28 54 views
2

我發現這個美妙的庫https://github.com/ACRA/acra崩潰報告跟蹤。 我已經將jar文件導入到我的項目中,並將ACRA.init添加到我當前的應用程序中。org.acra.CrashReportDialog not found

public class AppController extends Application { 
....... 
@Override 
public void onCreate() { 
    super.onCreate(); 
    mInstance = this; 
    ACRA.init(this); 
} 

<application 
     android:name="com.mobiledev.Synergy.control.AppController" 
     android:label="@string/app_name"> 

而且每次運行應用程序時都會出現此錯誤。

STACK_TRACE=android.content.ActivityNotFoundException: Unable to find explicit activity class {com.mobiledev.Synergy/org.acra.CrashReportDialog}; have you declared this activity in your AndroidManifest.xml? 

at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1556) 
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1431) 
at android.app.ContextImpl.startActivity(ContextImpl.java:1054) 
at android.app.ContextImpl.startActivity(ContextImpl.java:1043) 
at android.content.ContextWrapper.startActivity(ContextWrapper.java:283) 
at org.acra.ErrorReporter.notifyDialog(ErrorReporter.java:757) 
at org.acra.ErrorReporter$4.run(ErrorReporter.java:732) 

我想我需要包括acra jar文件中的CrashReportDialog活動。但我該怎麼做呢? 謝謝你們,

+0

發表您的整個AndroidManifest。 @山姆的回答是正確的。 – William 2014-09-28 21:31:59

+0

嗨威廉,現在每件事情都在起作用,我確實應用了山姆的答案,但起初它並沒有工作,於是我試着編譯項目並清理乾淨。還重新啓動我的應用程序。它現在工作正常。謝謝 – chkm8 2014-09-29 02:04:58

回答

2

您需要添加以下XML代碼清單檔案中的

<activity android:name="org.acra.CrashReportDialog" 
     android:theme="@android:style/Theme.Dialog" 
     android:launchMode="singleInstance" 
     android:excludeFromRecents="true" 
     android:finishOnTaskLaunch="true" /> 
+1

嗨山姆,我已經這樣做,但同樣的錯誤顯示。它不能找到org.acra.CrashReportDialog。有沒有我錯過了設置jar文件?我已閱讀關於添加jar來構建路徑,但我無法在我的Intellij中找到它。 – chkm8 2014-09-28 03:27:58

+0

確保您至少使用ACRA的v4.3版本 - 請參閱https://github.com/ACRA/acra/wiki/AdvancedUsage#dialog。如果有幫助,在我的應用程序的'build.gradle'文件中,我在'dependencies'部分有這個:'compile'c​​h.acra:acra:4.7.0'' – 2016-06-19 10:59:49

0

我只是面對完全一樣的問題,解決它像這樣:

  • 轉到庫jar所在的文件夾
  • 嘗試刪除jar(安全使用搜索)
  • (Android studio會要求確認是否有人療法要刪除的條目:
(workspaceroot)\(yourapppath)\build.gradle 

文件

  • 要更換
compile files('libs/acra-4.(version).jar') 

compile 'ch.acra:acra:4.7.0' 
  • 同步gradle這個(沒有在gradle產出的右上角鏈接文件的編輯)
  • 再次嘗試刪除的jar(要求)(它現在應該成功)
  • 運行你的應用程序,讓ACRA魔法閃耀...

問候,

S.