更新时间:2023-01-09 10:50:48
我找到了解决办法
问题是
Caused by: java.lang.NoClassDefFoundError: com.android.myproject.MyActivityClass
它找不到类路径,即使我是指同一个jar在两个项目(我也尝试过使用单独的JAR两个项目)
It cannot find the class path even though I refer the same jar in both projects ( I also tried by using separate jar for both the project )
现在,我创造了我的测试环境在同一个项目,然后它的工作
Now, I created my testing environment in the same project, then it worked
在我的的AndroidManifest.xml
<manifest...>
<!-- For doing JUnit test, Instrumentation Start (remove later) -->
<instrumentation
android:targetPackage="com.pe.android.isccasinos"
android:name="android.test.InstrumentationTestRunner" />
<!-- For doing JUnit test, Instrumentation End (remove later) -->
<application ...>
................
<!-- For doing JUnit test, add library starting (remove later) -->
<uses-library
android:name="android.test.runner" />
<!-- For doing JUnit test, add library ending (remove later) -->
</application>
<manifest>
然后我说我的测试类在我的特殊包测试
Then I added my Testing class in my special package for testing
extends ActivityInstrumentationTestCase2<fragmentActivity>
现在一切正常:)