Lottie-android: Java 8 compilation error version 2.5.6

Created on 1 Jul 2018  路  8Comments  路  Source: airbnb/lottie-android

lottie-react-native project target this library as 2.5.+ dependency,
as 2.5.5 we could compile fine since it was compiled with java 1.7.
now as 2.5.6:
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.

how to fix that ? thx

Most helpful comment

I have temporary solved issue by forcing gradle to take 2.5.5 version

configurations.all {
    resolutionStrategy {
        force "com.airbnb.android:lottie:2.5.5"
      }
    }

by adding this in project's build.gradle file

All 8 comments

Why was this change necessary? I use desugar=false because of a different issue and that means I can't use the latest lottie version.

I have temporary solved issue by forcing gradle to take 2.5.5 version

configurations.all {
    resolutionStrategy {
        force "com.airbnb.android:lottie:2.5.5"
      }
    }

by adding this in project's build.gradle file

I had to add the line from @AnujKosambi to
android/app/build.gradle
In the section

android{
    ...
    configurations.all {
        resolutionStrategy {
            force 'com.airbnb.android:lottie:2.5.5'
        }
    }
}

for it to work correctly.

I have same issue, with lottie 2.5.0

error
/////////

Running dex as a separate process.

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html

Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
4 errors; aborting
:app:transformClassesWithDexForDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformClassesWithDexForDebug'.
    > com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

tried increasing heap size, no use.

I'll revert the java 8 upgrade

This is fixed in 2.5.7, but somehow 2.5.7 never made it into the maven repository. So either we'll have to wait for 2.6.0 or 2.5.7 should be properly released.

Was this page helpful?
0 / 5 - 0 ratings