Error with Android test runner
See original GitHub issue09-03 18:42:38.480 17430 18550 E AndroidRuntime: java.lang.LinkageError: Method void org.conscrypt.KitKatPlatformOpenSSLSocketImplAdapter.connect(java.net.SocketAddress) overrides final method in class Lcom/android/org/conscrypt/AbstractConscryptSocket; (declaration of 'org.conscrypt.KitKatPlatformOpenSSLSocketImplAdapter' appears in /data/app/okhttp.android.test.test-ephEWmiS3OOVKojjslEi-g==/base.apk!classes5.dex)
09-03 18:42:38.480 17430 18550 E AndroidRuntime: at java.lang.Class.classForName(Native Method)
09-03 18:42:38.480 17430 18550 E AndroidRuntime: at java.lang.Class.forName(Class.java:454)
09-03 18:42:38.480 17430 18550 E AndroidRuntime: at android.support.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:72)
09-03 18:42:38.480 17430 18550 E AndroidRuntime: at android.support.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:104)
09-03 18:42:38.480 17430 18550 E AndroidRuntime: at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:789)
09-03 18:42:38.480 17430 18550 E AndroidRuntime: at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:539)
09-03 18:42:38.480 17430 18550 E AndroidRuntime: at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:382)
09-03 18:42:38.480 17430 18550 E AndroidRuntime: at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Why is the Android test runner reporting "Empty test suite"?
This worked for me. I was getting Empty test suite error. It could be because i added PowerMockito after the configuration was created...
Read more >Grade test runner not working with AndroidX project ...
I sync'd/built the current version of androidx-main (the public repo). It built just fine, and I launched studio (./studiow main).
Read more >Instrumented test execution with ...
This solved the issue for me i.e the core,runner,rules,orchestrator test deps should be updated to same version. now all AndroidTest cases runs ...
Read more >Test - Android Developers
Bug fixes * Fix ActivityScenario's issue with starting an Activity from intent with package name in self-instrumenting tests. Core Core-ktx 1.4.1-alpha05. Mar ...
Read more >Troubleshooting instrumentation tests in AWS Device Farm
The following topic lists error messages that occur during the upload of Instrumentation tests ... AndroidJUnitRunner " (Raw: "android.support.test.runner.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is a bit of a tricky one.
We did indeed swap a method to final in AbstractConscryptSocket that makes KitKatPlatformOpenSSLSocketImplAdapter not loadable on Android 10. If we hadn’t done that, this problem wouldn’t exist, but it’s too late to change it in the platform now.
However, that class shouldn’t be loaded on anything but KitKat. We only ever reference it behind an SDK_INT check, and the classloader doesn’t load anything until it’s referenced for the first time. So apps running on Android 10 will still work properly.
The problem here is that the Android test runner proactively loads all the classes in the classpath in order to find out which ones have test annotations or other things that it cares about. That causes it to attempt to load the class, which won’t work on Android 10.
We’re going to ask the test runner developers to treat LinkageError the same way they treat ClassNotFoundException, so that it just ignores the class and continues on. Hopefully they’re okay with that, which will solve the problem in the long term.
As a workaround, you can add the KitKat class (and any others that fail) to your test exclusion filter. It’s weird to do, since it’s not a test class, but it will prevent the test runner from attempting to scan it.
We’re also considering creating a distribution that doesn’t have the KitKat and pre-KitKat classes in it. I imagine a lot of apps don’t need to support KitKat, so that would benefit them on code size and allow them to ignore this particular problem. We haven’t decided whether that’s a good idea yet, though.
For other readers with the same problem, we got the explained workaround working: