mauriciotogneri / green-coffee

Green Coffee
MIT License
231 stars 21 forks source link

java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation. #27

Open odravison opened 1 year ago

odravison commented 1 year ago

Hi,

I'm facing this error: java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation. I believe that occurs due to outdated library import static android.support.test.InstrumentationRegistry.getTargetContext; since my stacktrace drove me to this line: Localization localization = new Localization(getTargetContext()); into GreenCoffeTest.java file.

Whole stacktrace:

java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation.
at android.support.test.InstrumentationRegistry.getInstrumentation(InstrumentationRegistry.java:44)
at android.support.test.InstrumentationRegistry.getTargetContext(InstrumentationRegistry.java:82)
at com.mauriciotogneri.greencoffee.GreenCoffeeTest.<init>(GreenCoffeeTest.java:29)
at ShowPopupFeatureTest.<init>(ShowPopupFeatureTest.kt:13)
mauriciotogneri commented 1 year ago

Hi @odravison,

Sorry to hear that. Unfortunately I stopped the development of this library about 5 years ago so I couldn't keep up with the changes in the platform.

Did you try to run the sample app to see if it has the same error? https://github.com/vndly/green-coffee-example

In case there is indeed a problem with the library, to be honest I won't have much time to work on a fix. But feel free to make a pull request if you manage to fix it and I will do my best to review it and merge it.