so I have method that looks like this :
public void testSingleGames() throws InterruptedException {
try {
Log.d("TEST","JSON");
} catch (JSONException e) {
e.printStackTrace();
fail("JSONException!!");
}
I simply want to call that method elsewhere : testSingleGames();
though it says : Unhandled Exception.java.lang.InterruptedException.
I tried the suggested fix android studio gave me , which is :
try {
testSingleGames();
} catch (InterruptedException e) {
e.printStackTrace();
}
my app crashes when I do though. So how do I call this mehod properly ?
EDIT :
here some STACKTRACES :
I think this one is the "main cause" since text was marked red:
Process: com.test.test, PID: 4097
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.test/com.test.test.MainActivity}: java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation.
at android.support.test.InstrumentationRegistry.getInstrumentation(InstrumentationRegistry.java:45)
at android.support.test.InstrumentationRegistry.getContext(InstrumentationRegistry.java:75)
at com.test.test.MainActivity.setUp(MainActivity.java:61)
at com.test.test.MainActivity.testSingleGames(MainActivity.java:69)
at com.test.test.MainActivity.onCreate(MainActivity.java:122)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Edit 2 : Ok I googled this line : No instrumentation registered! Must run under a registering instrumentation.
Previously I had a problem dependencies:
Conflict with dependency 'com.android.support.test:runner' in project ':app'. Resolved versions for app (0.5) and test app (1.0.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
I "fixed" it by changeing :
androidTestImplementation 'com.android.support.test:runner:1.0.1'
to Implementation 'com.android.support.test:runner:1.0.1'
so the error went away .
Maybe this is the root cause ?
I hope someone can make sense of this o.O , since I just tried to dabble abit with some api which is throwing all kinds of problems at me -.- ...