appsflyer-react-native-plugin
appsflyer-react-native-plugin copied to clipboard
TypeError: null is not an object (evaluating 'RNAppsFlyer.initSdkWithPromise') with Expo on Android Emulator
I am trying to init the AppsFlyer in my Expo 46 project on my Android emulator (Pixel_4 phone running Android API 28).
Here's my package.json:
"dependencies": {
"@react-native-async-storage/async-storage": "~1.17.3",
"expo": "46.0.0",
"expo-constants": "~13.2.4",
"expo-font": "~10.2.0",
"expo-location": "~14.3.0",
"expo-notifications": "~0.16.1",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"expo-tracking-transparency": "^2.3.1",
"expo-updates": "~0.14.5",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.5",
"react-native-appsflyer": "6.8.2",
"react-native-safe-area-context": "4.3.1",
"react-native-web": "~0.18.7",
"react-native-webview": "11.23.0"
}
My apps.json:
"plugins": [
[
"react-native-appsflyer",{}
]
]
Here's the code that is run:
import appsFlyer from 'react-native-appsflyer'
export const init = async () => {
try {
console.log(`0 init AppsFlyer with devKey: YYYY`)
appsFlyer.initSdk({
"isDebug": true,
"devKey": "XXXX",
"onInstallConversionDataListener": true,
"onDeepLinkListener": true,
"timeToWaitForATTUserAuthorization": 10,
"appId": "YYYY"
}, (result) => {
console.log(`in success handler of appsflyer sdk init...`)
console.log(result)
},
(error) => {
console.log(`in error handler of appsflyer sdk...`)
console.error(error)
})
console.log(`1. init AppsFlyer ok`)
} catch (error) {
console.log(error)
}
}
In the WebStorm terminal I run:
npm i
npm start
My emulator opens and the splash screen shows and hangs.
In my Webstorm terminal I see:
Logs for your project will appear below. Press Ctrl+C to exit.
› Opening on Android...
› Opening exp://192.168.1.12:19000 on Pixel_4_API_28
› Press ? │ show all commands
Android Bundling complete 8277ms
LOG 0 c). init AppsFlyer with devKey: YYYY
LOG [TypeError: null is not an object (evaluating 'RNAppsFlyer.initSdkWithPromise')]
I googled this error message RNAppsFlyer.initSdkWithPromise but found nothing and after hours of different attempts I am stuck.
I also ran this on my iphone 8 running iOS15.6.1by scanning the QR code provided by the npm start command and see the same error message.
Do I need to separately install the AppsFlyer SDK or does this come with your API?
Can you please help?
I am having the same issue, any updates?
same issue
any updates ? @JeremyColton @nicusbonannus
@JeremyColton this api is part of the sdk. Do you work with expo-dev-client as mentioned here?
@amit-kremer93 yes but same error
👋 Hi @JeremyColton and Thank you for reaching out to us. In order for us to provide optimal support, please submit a ticket to our support team at [email protected]. When submitting the ticket, please specify:
- ✅ your AppsFlyer sign-up (account) email
- ✅ app ID
- ✅ production steps
- ✅ logs
- ✅ code snippets
- ✅ and any additional relevant information.
Having the same issue as well
Did anyone find a fix?
I'm having the same issue...
any updates?
In my case you can resolve this issue by following these steps
Either clear your simulator and reinstall the app or:
> $ cd android
> $ ./gradlew uA
> $ ./gradlew clean
or
> $ npx react-native clean
Now follow manual linking steps for Android
Open Android Studio and sync gradle files then install & start android
We had this issue as well, I believe we resolved it by following the manual install steps for android.
This how I was able to resolve this in Expo SDK 49 using a dev-client
I created a new dev-client build after installing react-native-appsflyer and things started working
The reason for this is because react-native-appsflyer is on the native layer and not the JS layer so you need to create a new build that bundles the react-native-appsflyer native code.