在所有模块下运行android工具测试时,遇到以下异常。仅供参考,同时使用org.mozilla:rhino:1.7.7和org.mozilla:rhino:1.7.9的最新版本进行测试。仅在运行仪器测试时才会发生。应用正常运行。
捕获的Logcat:
`07-27 23:39:22.208 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.assertj.core.internal.cglib.transform.AbstractProcessTask
07-27 23:39:22.209 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.assertj.core.internal.cglib.transform.AbstractProcessTask>
Rejecting re-init on previously-failed class java.lang.Class<org.assertj.core.internal.cglib.transform.AbstractTransformTask>
Rejecting re-init on previously-failed class java.lang.Class<org.assertj.core.internal.cglib.transform.AbstractTransformTask>
Rejecting re-init on previously-failed class java.lang.Class<org.assertj.core.internal.cglib.transform.AbstractTransformTask>
07-27 23:39:22.210 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.assertj.core.internal.cglib.transform.AbstractTransformTask
07-27 23:39:24.035 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.ContextWindow>
07-27 23:39:24.036 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.ContextWindow>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.ContextWindow>
07-27 23:39:24.036 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.ContextWindow
07-27 23:39:24.040 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.EvalTextArea>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.EvalTextArea>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.EvalTextArea>
07-27 23:39:24.040 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.EvalTextArea
07-27 23:39:24.042 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.EvalWindow>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.EvalWindow>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.EvalWindow>
07-27 23:39:24.042 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.EvalWindow
07-27 23:39:24.043 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.Evaluator>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.Evaluator>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.Evaluator>
07-27 23:39:24.044 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.Evaluator
07-27 23:39:24.045 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FileHeader>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FileHeader>
07-27 23:39:24.046 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FileHeader>
07-27 23:39:24.046 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.FileHeader
07-27 23:39:24.047 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FilePopupMenu>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FilePopupMenu>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FilePopupMenu>
07-27 23:39:24.047 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.FilePopupMenu
07-27 23:39:24.048 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FileTextArea>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FileTextArea>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FileTextArea>
07-27 23:39:24.049 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.FileTextArea
07-27 23:39:24.050 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FileWindow>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FileWindow>
07-27 23:39:24.055 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FileWindow>
07-27 23:39:24.056 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.FileWindow
07-27 23:39:24.057 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FindFunction>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FindFunction>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.FindFunction>
07-27 23:39:24.057 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.FindFunction
07-27 23:39:24.058 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.JSInternalConsole>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.JSInternalConsole>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.JSInternalConsole>
07-27 23:39:24.058 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.JSInternalConsole
07-27 23:39:24.060 19504-19583/com.xxx.xxx.xxx.test W/AndroidJUnit4Builder: java.lang.NoClassDefFoundError: java.awt.Dimension in hasTestMethods for org.mozilla.javascript.tools.debugger.Main
07-27 23:39:24.070 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.Menubar>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.Menubar>
07-27 23:39:24.071 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.Menubar>
07-27 23:39:24.071 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.Menubar
07-27 23:39:24.072 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.MoreWindows>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.MoreWindows>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.MoreWindows>
07-27 23:39:24.072 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.MoreWindows
07-27 23:39:24.073 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.MyTableModel>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.MyTableModel>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.MyTableModel>
07-27 23:39:24.073 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.MyTableModel
07-27 23:39:24.073 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.JTreeTable>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.JTreeTable>
07-27 23:39:24.074 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.JTreeTable>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.MyTreeTable>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.MyTreeTable>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.MyTreeTable>
07-27 23:39:24.074 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.MyTreeTable
07-27 23:39:24.076 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.SwingGui>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.SwingGui>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.SwingGui>
07-27 23:39:24.076 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.SwingGui
07-27 23:39:24.077 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.TreeTableModel>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.TreeTableModel>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.TreeTableModel>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.VariableModel>
07-27 23:39:24.078 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.VariableModel>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.VariableModel>
07-27 23:39:24.078 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.VariableModel
07-27 23:39:24.079 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.AbstractCellEditor>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.AbstractCellEditor>
Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.AbstractCellEditor>
07-27 23:39:24.079 19504-19583/com.xxx.xxx.xxx.test E/TestLoader: Could not find class: org.mozilla.javascript.tools.debugger.treetable.AbstractCellEditor
07-27 23:39:24.079 19504-19583/com.xxx.xxx.xxx.test I/art: Rejecting re-init on previously-failed class java.lang.Class<org.mozilla.javascript.tools.debugger.treetable.JTreeTable>
java.lang.NoClassDefFoundError: org.mozilla.javascript.tools.debugger.treetable.JTreeTable
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:309)
at android.support.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:76)
at android.support.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:110)
at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:809)
at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:487)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:373)
at com.xxx.support.test.xxxTestRunner.onStart(xxxTestRunner.java:13)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1853)
07-27 21:47:04.930 1084-2189/system_process W/ActivityManager: Error in app com.xxx.xxx.xx.test running instrumentation ComponentInfo{com.xxx.xxx.xxx.test/com.xxx.xxx.xxx.xxxTestRunner}:
java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: org.mozilla.javascript.tools.debugger.treetable.JTreeTable`
如果在构建级别中删除实现'org.mozilla:rhino:1.7.7'并删除所有javascript执行,则测试运行正常。在Android 6.0、5.1.1设备上进行了测试。
经过大量尝试,发现在“ all in module”选择下运行测试时,将抛出classNoFound以上问题;但是当选择“全部打包”运行并指定了打包路径时,仪器测试运行就没有问题。