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)

Most upvoted comments

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. captura de tela 2017-06-27 as 22 26 40

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.

What are the limitations of Create React Native App?

The main limitation of a Create React Native App project is that it must be written in pure JavaScript and not have any dependencies which rely on custom native code (i.e. ones which require running react-native link to work). This allows the projects to load directly on a phone without native compilation, and also means that it’s not necessary to install or use Android Studio or Xcode.

https://github.com/react-community/create-react-native-app#what-are-the-limitations-of-create-react-native-app

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. screen shot 2017-09-07 at 5 35 11 pm

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”

See also #128 which is the same issue.

Running pod install, deleting ios/build, and running react-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