Mapbox-gl-native: Can't run 6.0.0-x on Lollipop?

Created on 4 Mar 2018  路  8Comments  路  Source: mapbox/mapbox-gl-native

Hi,
version 5.5.0 compiles and runs fine but 6.6.0-beta.3 has this issue on Android Studio when RUNNING the app (the project build runs fine)

Error:Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)

and

Invoke-customs are only supported starting with Android O (--min-api 26)
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex '/Users/qq/.gradle/caches/transforms-1/files-1.1/mapbox-android-sdk-6.0.0-beta.3.aar/deab756594fb90ee5107d36fe1944279/jars/classes.jar' to '/Users/qq/Android/AndroidStudioProjects/proj/maps/build/intermediates/transforms/preDex/flavor/release/5.jar'

I'm using Android Studio 3.1 beta but I had the same issue with the stable AS version

Compile SDK set to 27.0.3

I need to have minSDK 21 for the application though. Is version 6 running on that?

Thanks

Android support

Most helpful comment

Thanks for reporting your issue @leelx78. Our upcoming 6.0.0 release includes support for Java 8 features, therefore in order to run it (or any of the betas) you need to upgrade your project to include Java 8 support by adding this into you app's gradle file:

android {
    ...
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

or enabling Java 8 support for your project from Android Studio menu.

All 8 comments

Thanks for reporting your issue @leelx78. Our upcoming 6.0.0 release includes support for Java 8 features, therefore in order to run it (or any of the betas) you need to upgrade your project to include Java 8 support by adding this into you app's gradle file:

android {
    ...
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

or enabling Java 8 support for your project from Android Studio menu.

Thanks!

Does not work for me

we have same error even setting compileoptions for java version in gradle.

dx tool failed: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: default or static interface method used without --min-sdk-version >= 24
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
3 errors; aborting

i hope you wil remove these java8 problematic features soon.
there are tons of problems with java8.

Follow these simple steps:

1.Goto File ->Project Structrure
2.Click on "Modules" at left side
3.Choose the value as 1.8 in source compatibility
4.Choose the value as 1..8 in target compatibility
5.Click Apply and ok.
6.Click on Build Menu item and Rebuild it.

It worked for me
Thanks!!

its worked, OMG thank you save my day

Was this page helpful?
0 / 5 - 0 ratings