react-native-safe-area-context
react-native-safe-area-context copied to clipboard
Build failed: Kotlin complaining type mismatch in SafeAreaContextModule.kt
build.gradle of my app
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
classpath("com.google.gms:google-services:4.4.0")
}
}
The error:
e: file:///.../react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt:17:63 Type mismatch: inferred type is Map<String, Any>? but Any was expected
The screenshot:
React Native version & version of this library?
Just found a workaround by changing
return MapBuilder.of<String, Any>("initialWindowMetrics", getInitialWindowMetrics())
return MapBuilder.of<String, Any>("initialWindowMetrics", getInitialWindowMetrics()!!)
Looks like the Map doesn't allow null values?
Maybe try updating react-native-safe-area-context?
I am also having this issue with same verisions. Can we get a fix for this in the package?
> Task :react-native-safe-area-context:compileReleaseKotlin FAILED
e: file:///Users/Exposure/Development/AppDevRN/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt:17:63 Type mismatch: inferred type is Map<String, Any>? but Any was expected
MapBuilder.of
@objectkuan Where is this change is supposed to be made, which file? Thank you.