3

I'm using android studio 3.0.0 Beta 5 and according to this link I should be able to use some Java 8 features for any SDK version. But instead, I'm getting this exception for the targeted SDK 22:

default or static interface method used without --min-sdk-version >= 24

While in the previous link, it is said that Default and static interface methods features is available for any SDK.

PS: the dependency using Java 8 is Spark

4
  • Based on that error message, my guess is that it is a documentation bug. Or, perhaps, it's a change due to the switch from the Jack-based Java 8 support to the newer javac-based Java 8 support. Commented Sep 25, 2017 at 13:49
  • In the link you provided it says about 24 SDK not the 22. Commented Sep 25, 2017 at 13:50
  • @Mike the link says that some are available for any SDK (no minimal SDK constraint) and some need of course at least SDK 24 Commented Sep 25, 2017 at 14:08
  • 1
    You must be doing something wrong in your project configuration. Default & static interface methods definitely do work with the desugar toolchain in Android Studio 3.0. I have tested that with compileSdkVersion 26, minSdkVersion 15 and targetSdkVersion 23. Commented Sep 25, 2017 at 19:48

1 Answer 1

1

The minSdk for default and static interface methods is 24. You can see the overview here

https://developer.android.com/guide/platform/j8-jack.html

But it should be available with the new Android Studio 3 according to the table here

https://developer.android.com/studio/write/java8-support.html

So it's either a documentation error or it's not ready yet.

Sign up to request clarification or add additional context in comments.

3 Comments

You're right! Both documentations are not saying the same thing... I hope that one of the Android developers working on this could give me the final answer...
With respect to "of not being ready": most of this worked (for me) already in the alpha-4 build. I'm on beta-6 now and haven't found any bugs yet.
Old "jack" compiler is deprecated. Now using new "default toolchain" you are able to use "Default and static interface methods" with any version of android min sdk.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.