Guava: Error: Dex cannot parse version 52 byte code

Created on 9 May 2017  路  2Comments  路  Source: google/guava

This is probably an old issue, but I can't find a reference to it. I just added:

    compile('com.google.guava:guava:21.0')

to the dependencies section of my gradle file and the following error message appeared:

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.

I've tried adding the targetCompatability and sourceCompatability tags to the gradle file, but still get the same error.
Is there a version of the .jar file that is compatible with Version 1.7 java?
Thanks.

Most helpful comment

https://github.com/google/guava/wiki/Release21#java-8

Guava 21.0 requires Java 8. If you need Java 6, 7 or Android compatibility, use Guava 20.0 for now. Guava 22.0 and on will introduce a Java 6/Android compatible backport of Guava that includes all of the latest changes that don't require Java 8.

All 2 comments

https://github.com/google/guava/wiki/Release21#java-8

Guava 21.0 requires Java 8. If you need Java 6, 7 or Android compatibility, use Guava 20.0 for now. Guava 22.0 and on will introduce a Java 6/Android compatible backport of Guava that includes all of the latest changes that don't require Java 8.

Thanks for the fast response!

Was this page helpful?
0 / 5 - 0 ratings