Didn't find class "java.util.concurrent.CompletableFuture"

android

#1

Hi,

I’m using CircleCI to test an android project - I recently added added a use of a Java 8 api: java.util.concurrent.CompletableFuture and now I’m getting java.lang.ClassNotFoundException: Didn't find class "java.util.concurrent.CompletableFuture". I’m using the circleci/android:api-27-alpha image which I understand is based on JKD8.

I’ve tried printing the java version in the job and it looks fine to me.

Does anyone have any pointers at what else could be happening?

Thanks,
Inti

Full stack trace:

java.lang.NoClassDefFoundError: Failed resolution of: Ljava/util/concurrent/CompletableFuture;
at com.jumpitt.workmentor.TestUtils.login(TestUtils.java:24)
at com.jumpitt.workmentor.MainActivityTest.onSyncClicked(MainActivityTest.java:94)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at android.support.test.internal.statement.UiThreadStatement.evaluate(UiThreadStatement.java:55)
at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:270)
at android.support.test.internal.statement.UiThreadStatement.evaluate(UiThreadStatement.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1853)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.util.concurrent.CompletableFuture" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.jumpitt.workmentor.test-1/base.apk", zip file "/data/app/com.jumpitt.workmentor-1/base.apk"],nativeLibraryDirectories=[/data/app/com.jumpitt.workmentor-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 36 more
Suppressed: java.lang.ClassNotFoundException: java.util.concurrent.CompletableFuture
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 37 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

#2

Fixed: https://stackoverflow.com/questions/48882690/didn-t-find-class-java-util-concurrent-completablefuture


#3