Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: null is not an object (evaluating 'RNAppsFlyer.initSdkWithPromise') with Expo on Android Emulator #430

Open
JeremyColton opened this issue Oct 9, 2022 · 12 comments

Comments

@JeremyColton
Copy link

JeremyColton commented Oct 9, 2022

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?

@nicusbonannus
Copy link

I am having the same issue, any updates?

@cankilinc
Copy link

same issue

@cankilinc
Copy link

cankilinc commented Oct 16, 2022

any updates ? @JeremyColton @nicusbonannus

@amit-kremer93
Copy link
Contributor

@JeremyColton this api is part of the sdk. Do you work with expo-dev-client as mentioned here?

@cankilinc
Copy link

@amit-kremer93 yes but same error

@github-actions
Copy link

github-actions bot commented Nov 2, 2022

👋 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 support@appsflyer.com.
When submitting the ticket, please specify:

  • ✅ your AppsFlyer sign-up (account) email
  • ✅ app ID
  • ✅ production steps
  • ✅ logs
  • ✅ code snippets
  • ✅ and any additional relevant information.

@Ali-Olliek
Copy link

Having the same issue as well

Did anyone find a fix?

@ApollonNishikawa
Copy link

I'm having the same issue...

@artklen
Copy link

artklen commented Mar 30, 2023

any updates?

@louisraetz
Copy link

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

@CTOverton
Copy link

We had this issue as well, I believe we resolved it by following the manual install steps for android.

@aremu-smog
Copy link

aremu-smog commented Apr 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants