Oh, I found it. It’s caused by the dependency of anko.
I created a small project as @pdvrieze says.
And I found that once I add the anko dependency, all the Kotlin
codes are complied in a lower Android API level (haven’t recorgnized which level it is), ignoring the targetSdkVersion I set.
At this time, not only
goes wrong. Many of the apis that require higher API level can not be used in Kotlin
code. (However, they can be used in Java
dose not fix such problem.)
Whatever, changing anko dependency to level 0.10.3 can fix this problem.
But I have to say, adding an implementation should not change the compiling API level of my project! (especially only change the compliling API level of Kotlin code but not Java together)
Is this a bug of anko or something else?