Apollo-android: Default interface methods are only supported starting with Android N (--min-api 24)

Created on 28 Apr 2020  路  2Comments  路  Source: apollographql/apollo-android

Summary

Error: Default interface methods are only supported starting with Android N (--min-api 24): com.apollographql.apollo.ApolloCall com.apollographql.apollo.ApolloMutationCall.cacheHeaders(com.apollographql.apollo.cache.CacheHeaders)

Description

Hello guys, I'm trying to migrate my project from v1.2.0 to V2.0.0 and my min. API is 21 as usual. After changing the proper dependencies and plugin name, Build was failed and showed this error to me.
I searched many places in announcements or issues, I couldn't find any info about making the min API 24 for any future Android projects.

I have tried to make my min API 24 and it worked correctly but API 21 compatibility is needed for my company project. Could you please explain to me if there is any solution for this? or I have to work with the old version again?

Thanks in advance

Version

2.0.0

Bug

Most helpful comment

Can you try to target java 8 in your android build.gradle file ? https://developer.android.com/studio/write/java8-support

android {
  ...
  // Configure only for each module that uses Java 8
  // language features (either in its source code or
  // through dependencies).
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
  // For Kotlin projects
  kotlinOptions {
    jvmTarget = "1.8"
  }
}

All 2 comments

Can you try to target java 8 in your android build.gradle file ? https://developer.android.com/studio/write/java8-support

android {
  ...
  // Configure only for each module that uses Java 8
  // language features (either in its source code or
  // through dependencies).
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
  // For Kotlin projects
  kotlinOptions {
    jvmTarget = "1.8"
  }
}

Thanks so much @martinbonnin , It worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TayfunCesur picture TayfunCesur  路  4Comments

jsiva001 picture jsiva001  路  4Comments

pratthama-appdesk picture pratthama-appdesk  路  3Comments

john-lanticse picture john-lanticse  路  3Comments

tasomaniac picture tasomaniac  路  4Comments