Android :java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
I had the same problem, and my code was something like this (for a normal login activity): onView(withId(R.id.username)) .perform(new TypeTextAction(“test_user”)); onView(withId(R.id.password)) .perform(new TypeTextAction(“test123”)); onView(withId(R.id.login)).perform(click()); The last line was crashing with SecurityException. Turned out after the last text typing, the keyboard was left open, hence the next click was considered on a different application. To fix … Read more