Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Studio Lint检查Kotlin的高阶函数_Android_Android Studio_Kotlin - Fatal编程技术网

Android Studio Lint检查Kotlin的高阶函数

Android Studio Lint检查Kotlin的高阶函数,android,android-studio,kotlin,Android,Android Studio,Kotlin,我已经看到了下面一个高阶函数的例子,它被用作包装Android API版本检查的方便方法 fun isLollipop(func: () -> Unit) { if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { func() } } 然而,在Android Studio 3.0(Kotlin版本1.2.0)中,如果我尝试使用需要棒棒糖的API,我会看到lint错误(该项目的minSdk为17)。例如: isLollipo

我已经看到了下面一个高阶函数的例子,它被用作包装Android API版本检查的方便方法

fun isLollipop(func: () -> Unit) {
  if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
    func()
  }
}
然而,在Android Studio 3.0(Kotlin版本1.2.0)中,如果我尝试使用需要棒棒糖的API,我会看到lint错误(该项目的minSdk为17)。例如:

isLollipop { appBarLayout.elevation = 4f }
Lint抱怨
标高
属性上的API最小值

作为旁注,如果将函数编写为
内联函数
,则无所谓,lint仍然给出相同的警告。使用内联函数,反编译的Java代码显然被版本检查所包围

我在不久前发现了这个讨论,但Kotlin团队似乎已经集成了linting支持


lint系统是否支持查看高阶函数?

这个问题似乎在Android Studio 3.2的最新版本中得到了解决。使用Kotlin runtime 1.2.30在金丝雀6上进行测试,无绒线警告