dd-sdk-reactnative: Android issue: null is not an object (evaluating 'this.nativeRum.startView')
Describe what happened Include any error message or stack trace if available.
Everything works on iOS, and data comes through to my DataDog dashboard. When attempting to run on Android emulators I receive this error after the app successfully installs and opens: null is not an object (evaluating 'this.nativeRum.startView'). It points to the file foundation.tsx and line 50.
I also tried clearing all caches multiple times.
Here is the stack trace:

Steps to reproduce the issue:
- tested with a Pixel 4 emulator with API 28 (Android 9.0), and a Galaxy S20 Ultra emulator with API 30 (Android 11.0)
Describe what you expected:
Additional context
- Version of the SDK
- @datadog/mobile-react-native@1.0.0-rc
- @datadog/mobile-react-navigation@1.0.0-rc4
- A copy of your package.json file:
- Note: I have ejected from expo
{
"name": "",
"scripts": {},
"dependencies": {
"@datadog/mobile-react-native": "^1.0.0-rc4",
"@datadog/mobile-react-navigation": "^1.0.0-rc4",
"@expo/vector-icons": "^12.0.0",
"@ptomasroos/react-native-multi-slider": "^2.2.2",
"@react-native-async-storage/async-storage": "^1.13.2",
"@react-native-community/cli-platform-ios": "^4.13.0",
"@react-native-community/cookies": "^5.0.1",
"@react-native-community/masked-view": "^0.1.6",
"@react-navigation/bottom-tabs": "^6.0.9",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^6.0.11",
"@unimodules/core": "~6.0.0",
"@unimodules/react-native-adapter": "~5.7.0",
"bcrypt": "^3.0.6",
"blinkid-react-native": "^5.8.1",
"expo": "^40.0.0",
"expo-asset": "~8.2.1",
"expo-constants": "~9.3.3",
"expo-facebook": "~9.1.0",
"expo-file-system": "~9.3.0",
"expo-font": "~8.4.0",
"expo-linear-gradient": "~8.4.0",
"install": "^0.13.0",
"lodash": "^4.17.15",
"npm": "^8.3.0",
"payment-icons": "^1.2.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "0.63.4",
"react-native-code-push": "^6.2.1",
"react-native-datepicker": "^1.7.2",
"react-native-dotenv": "^2.5.1",
"react-native-elements": "^1.2.7",
"react-native-firebase": "^5.6.0",
"react-native-gesture-handler": "~1.8.0",
"react-native-google-places-autocomplete": "^2.1.2",
"react-native-indicators": "^0.17.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-onesignal": "^4.0.1",
"react-native-picker-select": "^6.5.0",
"react-native-reanimated": "^1.7.0",
"react-native-rn-apple-pay-button": "github:brascene/rn-apple-pay-button",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^3.10.1",
"react-native-sectioned-multi-select": "^0.8.1",
"react-native-unimodules": "~0.12.0",
"react-native-vector-icons": "^6.6.0",
"react-native-video": "^5.0.0",
"react-native-web": "~0.13.12",
"react-redux": "^7.1.0",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"tipsi-stripe": "^9.1.1"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"@babel/runtime": "^7.8.4",
"@types/react": "~16.9.35",
"@types/react-native": "~0.63.2",
"babel-jest": "~24.9.0",
"babel-preset-expo": "8.3.0",
"jest": "~24.9.0",
"jetifier": "~1.6.4",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "~16.13.1",
"typescript": "^4.5.4"
},
"private": true
}
Any help is appreciated!
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 24 (9 by maintainers)
I face the same problem:
error [TypeError: null is not an object (evaluating '_$$_REQUIRE(_dependencyMap[5], "./foundation").DdSdk.initialize')]The initialization is exactly the same as the sample on dd console:
Hi @chiaraturbati, thanks for reaching out!
This is unfortunately a long standing issue that we have a hard time reproducing. I found this issue on the React Native repo suggesting to turn on the Debug mode for your app (which should open a Google Chrome tab) as a fix.
Could you try it and see if it works?
If this does not fix the issue, you can run
npx rn-game-over -j -ato clear all the javascript and android caches and see if it works.This is still an issue for me. The initialization fails because DdSdkReactNative is undefined, only happens on Android. EDIT: Its actually in DdRumReactNavigationTracking.tsx, when running DdSdk.initialize. DdSdk is undefined.
After adding mannuelly below import in MainApplication.java this issue got resolved
import com.datadog.reactnative.DdSdkReactNativePackage;example/android/app/src/main/java/com/example/ddsdkreactnative/MainApplication.java
Now working fine for me
Till facing this below issue in android [TypeError: null is not an object (evaluating ‘_$$_REQUIRE(_dependencyMap[7], “./foundation”).DdSdk.initialize’)]
I am sorry @0xnm We had to disable datadog on our next android build.
I had tried to comment you mentioned. No success.
Our dependencies are the following:
In my case