2016-03-10 49 views
0

我有大約200個使用Espresso運行的測試。他們中的大多數都是大型測試。雖然測試正在運行的應用程序崩潰,並在它說的日誌中,測試運行未完成。原因:'由於進程崩潰導致儀表運行失敗。當使用Espresso

測試未能運行完成。原因:「儀表運行失敗是由於」進程崩潰>

我認爲它是由於內存不足的問題。在拆卸方法中是否有任何可修復的內存來清除內存,以便我們可以在每次測試結束後清除內存?還是有其他解決此問題的解決方法嗎?我已經嘗試在測試清單文件中使用android:largeHeap =「true」。但它不工作。下面是完整的日誌,

java.lang.OutOfMemoryError: Failed to allocate a 50452 byte allocation with 43158 free bytes and 42KB until OOM 
at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95) 
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:163) 
at java.lang.StringBuilder.append(StringBuilder.java:288) 
at java.lang.StringBuilder.append(StringBuilder.java:44) 
at android.support.test.espresso.core.deps.guava.base.Joiner.appendTo(Joiner.java:111) 
at android.support.test.espresso.core.deps.guava.base.Joiner.appendTo(Joiner.java:152) 
at android.support.test.espresso.core.deps.guava.base.Joiner.appendTo(Joiner.java:140) 
at android.support.test.espresso.util.HumanReadables.getViewHierarchyErrorMessage(HumanReadables.java:76) 
at android.support.test.espresso.NoMatchingViewException.getErrorMessage(NoMatchingViewException.java:87) 
at android.support.test.espresso.NoMatchingViewException.<init>(NoMatchingViewException.java:59) 
at android.support.test.espresso.NoMatchingViewException.<init>(NoMatchingViewException.java:46) 
at android.support.test.espresso.NoMatchingViewException$Builder.build(NoMatchingViewException.java:145) 
at android.support.test.espresso.base.ViewFinderImpl.getView(ViewFinderImpl.java:95) 
at android.support.test.espresso.ViewInteraction$1.run(ViewInteraction.java:120) 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) 
at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:145) 
at android.app.ActivityThread.main(ActivityThread.java:5832) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) 

回答

1

我可能是錯的,但我可以看到你首先必須NoMatchingViewException,這意味着什麼是錯在你的測試和預期觀點未找到,那麼當咖啡試圖創建錯誤您收到了OOM錯誤消息。所以看起來根本原因是NoMatchingViewException。所以也許你應該先解決它。

相關問題