rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.27k stars 849 forks source link

build failed with the error: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type ReadableArray? #2769

Closed Ezzine-Smichi closed 1 year ago

Ezzine-Smichi commented 1 year ago

Environment

android/buil.gradle:

buildscript { ext { buildToolsVersion = "31.0.0" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 kotlinVersion = "1.6.0" androidXCore = "1.6.0" ndkVersion = "20.1.5948944" RNMapboxMapsImpl = "mapbox" } repositories { google() jcenter() maven { url "https://jitpack.io" } } dependencies { classpath('com.android.tools.build:gradle:4.1.0') // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { maven { url 'https://api.mapbox.com/downloads/v2/releases/maven' authentication { basic(BasicAuthentication) } credentials { // Do not change the username below. // This should always bemapbox(not your username). username = 'mapbox' // Use the secret token you stored in gradle.properties as the password password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: "" } } mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } maven { url 'https://maven.google.com' } google() jcenter() mavenCentral() maven { url 'https://www.jitpack.io' } configurations.all { resolutionStrategy { // Remove this override in 0.65+, as a proper fix is included in react-native itself. force "com.facebook.react:react-native:" + "0.62.2" } } } }

Steps to reproduce

when i buid the project, there are some errors:

mfazekas commented 1 year ago

Sorry it seems that the RN version you're using is too old. The @nonnull annotations causing the compile issue was fixed in RN 0.64, so you either upgrade to that, or add the ?. or !!., etc to the code, and use something like patch-package.

https://github.com/facebook/react-native/commit/d76556543f96f4d739be3a708b8f6314bb32cc87

bilalyaqoob commented 1 year ago

I am getting the same error my Rn version is "react-native": "0.63.5",