Mapbox-gl-native: Android Studio 3.1 D8 dexer compatibility issues

Created on 17 Apr 2018  路  3Comments  路  Source: mapbox/mapbox-gl-native

Platform: Android Studio 3.1.1, com.android.tools.build:gradle:3.1.1, D8 dexer *
*
Mapbox SDK version:6.0.0-beta.7

Steps to trigger behavior

  1. upgrade to Android Studio 3.1.1
  2. using com.android.tools.build:gradle:3.1.1
  3. D8 dexer enabled by default
    D8 official announcement

Expected behavior

build success

Actual behavior

BUILD FAILED

Caused by: com.android.tools.r8.utils.AbortException
    at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:77)
    at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:67)
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:62)
    ... 10 more
    Suppressed: com.android.tools.r8.ApiLevelException: Static interface methods are only supported starting with Android N (--min-api 24): com.mapbox.geojson.Geometry com.mapbox.geojson.Geometry.fromJson(java.lang.String)
        at com.android.tools.r8.dex.FileWriter.checkInterfaceMethod(FileWriter.java:234)
        at com.android.tools.r8.dex.FileWriter.checkInterfaceMethods(FileWriter.java:210)
        at com.android.tools.r8.dex.FileWriter.generate(FileWriter.java:140)
        at com.android.tools.r8.dex.ApplicationWriter.writeDexFile(ApplicationWriter.java:356)
        at com.android.tools.r8.dex.ApplicationWriter.lambda$write$2(ApplicationWriter.java:188)
        ... 5 more

by disable D8 in gradle.properties
android.enableD8=false
there's only warnning about the Static interface methods and build success

Most helpful comment

Thank you for the report, the issue shown is related to a newer java 8 language feature. Please add the following to your build.gradle:

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

All 3 comments

Thank you for the report, the issue shown is related to a newer java 8 language feature. Please add the following to your build.gradle:

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

Doesn't work for me

Try to delete all files in build folder.

Was this page helpful?
0 / 5 - 0 ratings