I am encountering the error of converting Bytecode to dex with the following trace.
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
Error:Execution failed for task ':app:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
Error:1 error; aborting
I know this is due to thoughtworks xstream library used by robolectric where version 1.4.8 is built for jdk 1.8 and it does not support my project. Trying to use Robolectric for Instrumentation Tests by adding dependency as follows,
androidTestCompile ("org.robolectric:robolectric:3.1.2")
Is there any workaround to solve this and run the tests ?