Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

converting android sample project to Kotlin gives ClassNotFoundException #114

Open
JimClermonts opened this issue May 19, 2020 · 4 comments

Comments

@JimClermonts
Copy link

When I convert MainActivityTest.java to kotlin, it gives below error:

$ adb shell am instrument -w -r -e notPackage org.bouncycastle.pqc.crypto.qtesla   -e debug false -e class 'io.appflate.restmock.androidsample.tests.MainActivityTest' io.appflate.restmock.androidsample.test/io.appflate.restmock.androidsample.CustomTestRunner
Connected to process 8637 on device 'lge-nexus_5x-024c6d7f5e96d337'.

Started running tests


java.lang.ClassNotFoundException: io.appflate.restmock.androidsample.tests.MainActivityTest
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at androidx.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:72)
at androidx.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:104)
at androidx.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:793)
at androidx.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:547)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:390)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932)
Caused by: java.lang.ClassNotFoundException: Didn't find class "io.appflate.restmock.androidsample.tests.MainActivityTest" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/io.appflate.restmock.androidsample.test-1/base.apk", zip file "/data/app/io.appflate.restmock.androidsample-2/base.apk"],nativeLibraryDirectories=[/data/app/io.appflate.restmock.androidsample.test-1/lib/arm64, /data/app/io.appflate.restmock.androidsample-2/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 8 more

Tests ran to completion.
@JimClermonts
Copy link
Author

And: Is this library end of life? Because we need to test co-routines but adding kotlin to the example project gives errors and it's not clear whether it is going to work.

@JimClermonts
Copy link
Author

We are gonna remove this library from our project if this is not solvable.

@andrzejchm
Copy link
Owner

andrzejchm commented Jun 3, 2020

Hey Jim, sorry for the late answer. When it comes to kotlin support, library works perfectly fine. I've used it in dozens of kotlin projects. I wouldn't consider the library end-of-life as I'm using it on a daily basis. The plan is for the next major version to port it entirely to kotlin.

Can't really say what's the problem is based only on the stacktrace. Have you tried to run the tests from command line with ./gradlew cDAT command?

@JimClermonts
Copy link
Author

Hello,
Thanks for the reply. Maybe if the example code can be updated to kotlin then it's easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants