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

Error when using Spectrum in Android instrumented tests #48

Open
RoRoche opened this issue Nov 14, 2016 · 2 comments
Open

Error when using Spectrum in Android instrumented tests #48

RoRoche opened this issue Nov 14, 2016 · 2 comments

Comments

@RoRoche
Copy link

RoRoche commented Nov 14, 2016

Just moving this file
to this directory

when running this command: gradle connectedCheck
I get the following error:

:app:transformClassesWithDexForDebugAndroidTestDex: 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.
	UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
		at com.android.dx.command.dexer.Main.processClass(Main.java:775)
		at com.android.dx.command.dexer.Main.processFileBytes(Main.java:741)
		at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
		at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1683)
		at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
		at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
		at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
		at com.android.dx.command.dexer.Main.processOne(Main.java:695)
		at com.android.dx.command.dexer.Main.processAllFiles(Main.java:592)
		at com.android.dx.command.dexer.Main.runMonoDex(Main.java:321)
		at com.android.dx.command.dexer.Main.run(Main.java:292)
		at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
		at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:173)
		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
		at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
		at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:476)
		at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
		at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
		at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
		at com.android.dx.command.dexer.Main.parseClass(Main.java:787)
		at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
		at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1722)
		at com.android.dx.command.dexer.Main.processClass(Main.java:773)
		... 16 more

1 error; aborting
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: 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
@greghaskins
Copy link
Owner

It's cool to see Spectrum being used in new places. I don't think we've tried it with Android yet.

I know for a while you couldn't use Java 8 on older versions of the Android SDK. There may be some configuration you'll need to change to enable it. After some quick searching, I found this reference page:

https://developer.android.com/guide/platform/j8-jack.html

If you try those instructions to configure your Gradle build, does that help?

@RoRoche
Copy link
Author

RoRoche commented Nov 16, 2016

OK, thanks.

I tried to add Jack to my projet. But it failed.
Obviously, it seems that there is a problem when using both the Jack compiler and the Kotlin language:

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