UIAutomation
was included in API 18
. NoSuchMethod
Exception occurs when you try to access/use a class/method that is not supported on OS/API version you are currently running the app on.
Android UIAutomation Instrumentation NoSuchMethod Exception
-
03-10-2022 - |
Question
Any idea why I get this exceptions. Its supposed to be very straight forward and simple. It compiles without any errors or warnings. At run time it throws exception.
Instrumentation im = new Instrumentation();
UiAutomation myVar = im.getUiAutomation();
myVar.injectInputEvent(evntDown,false);
Here's the exception.
01-26 11:59:17.344 17742-17742/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoSuchMethodError: android.app.Instrumentation.getUiAutomation
at com.infostretch.automateme.MainActivity$1.onClick(MainActivity.java:51)
at android.view.View.performClick(View.java:4202)
at android.view.View$PerformClick.run(View.java:17340)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow