react-native-sound: Cannot read property 'IsAndroid' of undefined
On iOS, in fresh project generated by latest version of create-react-native-app
: RNSound is not defined in NativeModules
of react-native
.
"dependencies": {
"expo": "^18.0.3",
"react": "16.0.0-alpha.12",
"react-native": "^0.45.1",
"react-native-sound": "^0.10.3"
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 14
- Comments: 31 (2 by maintainers)
I have this problem running test cases from Jest. Works fine in emulators and hardware for both Android and iOS.
Restarting Android Studio, my emulator, and terminal seemed to work for me.
So basically you’re closing an issue because “it works for me”. That’s not how things works you know?
Same here. Running through Expo a got this error. Also, I tried another way and got the application broken.
You need to delete your derived data in XCode:
/Users/{yourUserName}/Library/Developer/Xcode/DerivedData
create-react-native-app only works with pure JavaScript compontents. So it won’t work with react-native-sound, because it requires native code.
https://github.com/react-community/create-react-native-app#what-are-the-limitations-of-create-react-native-app
Have a look at https://github.com/zmxv/react-native-sound/issues/36#issuecomment-284443489 – this works for me
I am running into the same issue, where it builds for IOS but not for Android. It errors out at the import statement with undefined is not an object (evaluating ‘RNSound.IsAndroid’).
Android studio had an error about not being able to have non-gradle java modules and android-gradle modules in one project.
I think it was resolved once I updated react-native-sound from 23.0.1 to 25.0.0 in studio. I’ve reinstalled react-native-sound, relinked, and rebuilt everything but to no avail. Any help would be appreciated.
i have “react-native”: "0.46.4 and “react-native-sound”: “^0.10.4”
FYI … https://docs.expo.io/versions/v17.0.0/sdk/audio.html great stuff for expo users!
See also #128 which is the same issue.
Running
pod install
, deletingios/build
, and runningreact-native run-ios
solved this for me.If you’re still experiencing this issue, please open a new issue with steps to reproduce. If you have a universal solution, please open a pull request with a documentation update.
you need run react-native link react-native-sound