How to support previous versions of Android prior to Oreo?

Anytime I try to build SNAPSHOT 0.9 or 0.10 with anything but Min SDK >= 26, I get this error:

Error:Execution failed for task ‘:app:transformClassesWithDexBuilderForDebug’. org.gradle.tooling.BuildException: signature-polymorphic method called without --min-sdk-version >= 26

Anyone have any idea how to support previous versions of android? I need to go back at least as far as SDK 21.

Here is my app level build.gradle:

apply plugin: ‘’

apply plugin: ‘kotlin-android’

apply plugin: ‘kotlin-android-extensions’

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId ""
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner “”
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘

dependencies {
implementation fileTree(dir: ‘libs’, include: [’*.jar’])
implementation '’
implementation '’
implementation '’
implementation '’
testImplementation 'junit:junit:4.12’
androidTestImplementation(‘’, {
exclude group: ‘’, module: ‘support-annotations’
implementation “org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version”

compile(group: 'com.graphhopper', name: 'graphhopper-core', version: '0.9-SNAPSHOT') {
    exclude group: '', module: 'protobuf-java'
    exclude group: 'org.openstreetmap.osmosis', module: 'osmosis-osm-binary'
    exclude group: 'org.apache.xmlgraphics', module: 'xmlgraphics-commons'

compile 'org.mapsforge:vtm:0.8.0'
compile 'org.mapsforge:vtm-android:0.8.0'
compile 'org.mapsforge:vtm-android:0.8.0:natives-armeabi'
compile 'org.mapsforge:vtm-android:0.8.0:natives-armeabi-v7a'
compile 'org.mapsforge:vtm-android:0.8.0:natives-x86'
compile('org.mapsforge:vtm-jts:0.8.0') {
    exclude group: 'com.vividsolutions', module: 'jts-core'
compile 'org.mapsforge:vtm-themes:0.8.0'
compile 'com.caverock:androidsvg:1.2.2-beta-1'

// compile ‘com.vividsolutions:jts-core:1.14.0’

compile 'org.slf4j:slf4j-api:1.7.25'
compile 'org.slf4j:slf4j-android:1.7.25'

compile 'com.github.MKergall:osmbonuspack:6.4'

// Google Location and Activity Recognition
implementation ''


And project level build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.1.4-3’
repositories {

dependencies {
    classpath ''
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files


allprojects {
repositories {
maven { url “” }
maven { url “” }

task clean(type: Delete) {
delete rootProject.buildDir

See also issue #1144.

1 Like

I have seen this thread before and attempted to use the solutions provided, but still encountered build failures below SDK 26. Perhaps I am doing something wrong? Or am I misunderstanding, and this is still an issue?

Playing with latest Android release versions [Android Studio 2.3.3, Gradle 3.3, Android plugin 2.3.3, Android SDK 26], never seen any issues with GraphHopper

Though others have reported it and the proposed solution was to downgrade build tools to 25.0.X.

Odd. I suppose I will eventually have to solve this problem. Ignoring it for now.

See #1157 for an idea to play on Android.

For reference also here the Android documentation:

Desugar currently doesn’t support MethodHandle.invoke or MethodHandle.invokeExact. If your source code or one of your module dependencies use one of these methods you need to specify minSdkVersion 26 or higher. Otherwise, you get the following error:

Dex: Error converting bytecode to dex:
Cause: signature-polymorphic method called without --min-sdk-version >= 26

In some cases, your module may not be using the invoke or invokeExact methods even when they’re included in a library dependency. So, to keep using that library with minSdkVersion 25 or lower, enable code shrinking to remove unused methods. If that doesn’t work, consider using an alternative library that doesn’t use the unsupported methods.