I am using Kotlin's MutableMap in my Android project. And trying to do some action per item. So here is my code.
private val uris: MutableMap<String, Uri> = mutableMapOf()
// ... Fill the items here ...
uris.forEach {
val ref = FirebaseFirestore.getInstanse().reference
uploadFile(ref, it.value)
}
Everything just works fine at runtime, but my CI build fails with below lint error:
MyActivity.kt:142: Error: Call requires API level 24 (current min is 16): java.util.Map#forEach [NewApi]
uris.forEach {
~~~~~~~
I know we can't use JDK-8's Map for Android projects until the min sdk is 24. But why lint is considering it as JDK-8's Map?
For further information I tried getting the Java code from Kotlin Bytecode option in AS and found that forEach is replaced with while loop and iterator as expected.
So what could be reason and how to solve this? Any lead will be appreciated.