ClassCastException in JUnit tests with Android KitKat

I am considering an issue on Android KitKat that has not appeared before.

I use JUnit tests with Robotium and everything in the test works well, except for Android KitKat (with updated Nexus 4 and nexus 5).

When I want to perform a solo action, I always have the same exception:

java.lang.ClassCastException: java.util.ArrayList cannot be cast to android.view.View[] at com.jayway.android.robotium.solo.ViewFetcher.getWindowDecorViews(ViewFetcher.java:399) at com.jayway.android.robotium.solo.ViewFetcher.getAllViews(ViewFetcher.java:81) at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:165) at com.jayway.android.robotium.solo.Waiter.waitForView(Waiter.java:254) at com.jayway.android.robotium.solo.Waiter.waitForView(Waiter.java:233) at com.jayway.android.robotium.solo.Solo.clickOnView(Solo.java:967) at com.example.TestClass.testMethod(TestClass.java:61) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214) at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199) at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701) 

Do you know if there is a reason for this?

+6
source share
1 answer

I was with robotium 4.3.

Updating it with the just updated version 4.3.1 solved this problem.

+8
source

Source: https://habr.com/ru/post/958633/


All Articles