A call requires an api level in non-android modules

I get call requires api level X in non-android modules when using Java 8 functions. How to remove it. Suppressing with annotation doesn't seem to me the right way

+8
android-studio java-8 lint
source share
1 answer

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

Android supports all Java 7 language features and a set of Java 8 language features that vary by platform version.

To support Java 8 language features, a new Jack compiler is required. Jack is only supported on Android Studio 2.1 and higher.

Android does not support all the features of the Java 8 language. However, when developing applications oriented to Android 7.0 (API level 24) , the following functions are available:

  • Default Methods and Static Interfaces
  • Lambda expressions (also available at API level 23 and below)
  • Duplicate annotations
  • Method references (also available at API level 23 and below)
  • Sample annotations (also available at API level 23 and below)

... I have an emphasis.

0
source share

All Articles