Android :java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission

前端 未结 9 1446
感动是毒
感动是毒 2020-12-01 11:48

Hi there I am new to Android Junit testing:

I have written some test code in MainActivityFunctionalTest.java file

MainActivityFunctionalTest.java:

         


        
9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 12:33

    I had exactly the same problem and error message when running espresso tests. One of them was always failing when running whole package, however it always passed when I was running it alone. Interesting thing was that the problem happened because I had added following line to one of my Activities in AndroidManifest.xml:

    android:windowSoftInputMode="stateUnchanged|adjustResize"
    

    After removing or changing above line to:

    android:windowSoftInputMode="stateHidden"
    

    mentioned test was passing also when running whole package.

提交回复
热议问题