Android Convenience Image Moving to Java v11 on August 17th

Migration Notes

Information that might help, curated from the CircleCI Community.

UseCGroupMemoryLimitForHeap

If you’re running into an error with UseCGroupMemoryLimitForHeap, this is because this was an experimental flag that was dropped in Java v10. The new Android images use Java v11 and thus don’t support this. You can use -XX:+UseContainerSupport instead.

JAXB

JAXB is not included with JDK 11, so your project has dependencies on the JAXB API or tools, you may need to include them yourself.

Robolectric

Someone has said that Robolectric doesn’t work with version <= 4.2.1. They recently released Robolectric 4.4 which officially includes support for Java v11 (and Java v13 for that matter).

SDKManager Binary

It looks like some people were calling sdkmanager using the full path $ANDROID_HOME/tools/bin/sdkmanager. The preferred method is to just call the binary itself sdkmanager.

This is especially relevant if you get an error like this:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
	at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
	at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
	at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 5 more

Sticking with the old image

You can use the old image by switching your config from specifying the SHA hash of the image you were using instead of the tag. We don’t recommend sticking with the old Java v8 based images if you can avoid it. When pinning an image via a hash, they’re no longer supported thus won’t receive any updates. This can be done as a temporary measure. Information on how to do this can be found here.

Android API 29 digest: circleci/android@sha256:b6646fdf7457f61825526e7bfce364d8e533da6ceb1cdb98e371e94348ecc834

Android API 28 digest: circleci/android@sha256:061e2535826cc3fe4c4a440e716bf06c36c80401ee635c339c6803b3e427ebb3

2 Likes