Troubleshooting React Native
Common issues on React Native.
I get Error: WonderPush native module not initialized
Error: WonderPush native module not initialized
You have run the following commands:
npm install react-native-wonderpush --save
npm install react-native-wonderpush-fcm --save
but you probably forgot to run the following two:
react-native link react-native-wonderpush
react-native link react-native-wonderpush-fcm
Also, make sure you have ejected Expo and run using the native tools:
expo eject
Deep links do not seem to work
There are extra steps to make deeplinking work on ReactNative, they are described in this guide.
Firebase fails to initialize. My installation is opt-out.
If you are using React Native Firebase (https://rnfirebase.io/) and encounter one of the following errors:
java.lang.IllegalArgumentException: Please set your project ID. A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google.
Could not get Firebase InstanceId
java.io.IOException: FIS_AUTH_ERROR
You will temporarily need to downgrade a few components of Firebase until we devise a fix and release a new SDK version. As mentioned on https://rnfirebase.io/, you will need to override the native Firebase SDK version.
Since React Native Firebase internally sets the versions of the native Firebase SDKs, you will need to override them for compativility with WonderPush.
Edit your android/app/build.gradle
to add:
project.ext {
set('react-native', [
versions: [
firebase: [
// Override Firebase SDK Version for compatibility with WonderPush SDK v3.4.0 and earlier
bom: "20.1.0",
],
],
])
}
If you have any further issue, do not hesitate to contact us by chat.
Module was compiled with an incompatible version of Kotlin
If you see the following errors:
> Task :react-native-wonderpush-fcm:compileDebugKotlin FAILED
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: ~/.gradle/caches/transforms-3/2cfe106a332c6a6f2245988cf5920bcb/transformed/jetified-kotlin-stdlib-common-1.6.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
e: ~/.gradle/caches/transforms-3/8fa201288e2c6500b9e1af2f8ed9c77c/transformed/jetified-kotlin-stdlib-jdk7-1.6.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
e: ~/.gradle/caches/transforms-3/b6d16718b0badf943a01bd505b26edc1/transformed/jetified-kotlin-stdlib-jdk8-1.6.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
e: ~/.gradle/caches/transforms-3/d3fc290c9b603f2d0c573f31aa64957d/transformed/jetified-kotlin-stdlib-1.6.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
e: ~/.gradle/caches/transforms-3/fcb0bc3264f9d378912d589ac764afdd/transformed/jetified-react-native-0.70.2-debug-api.jar!/META-INF/ReactAndroid_debug.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
e: /data/notiflex/gits/notiflex-platform-scripts/sdk/install/WonderPushExample/node_modules/react-native-wonderpush-fcm/android/src/main/java/com/wonderpush/sdk/reactnative/fcm/WonderPushFcmModule.kt: (19, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
The class is loaded from ~/.gradle/caches/transforms-3/d3fc290c9b603f2d0c573f31aa64957d/transformed/jetified-kotlin-stdlib-1.6.10.jar!/kotlin/Unit.class
e: /data/notiflex/gits/notiflex-platform-scripts/sdk/install/WonderPushExample/node_modules/react-native-wonderpush-fcm/android/src/main/java/com/wonderpush/sdk/reactnative/fcm/WonderPushFcmPackage.kt: (18, 16): Unresolved reference: emptyList
You will need to specify an explicit version of Kotlin to use for your whole project, so that our modules use it too.
Edit your android/build.gradle
to add:
buildscript {
ext {
kotlinVersion = "1.6.10"
}
}
Updated almost 2 years ago