React-native-sound: Cannot read property 'IsAndroid' of undefined

Created on 26 Jun 2017  路  31Comments  路  Source: zmxv/react-native-sound

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"
  }
build question

Most helpful comment

I have this problem running test cases from Jest. Works fine in emulators and hardware for both Android and iOS.

All 31 comments

Did you run react-native link react-native-sound?

Yep

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

FYI ... https://docs.expo.io/versions/v17.0.0/sdk/audio.html great stuff for expo users!

You need to delete your derived data in XCode: /Users/{yourUserName}/Library/Developer/Xcode/DerivedData

Restarting Android Studio, my emulator, and terminal seemed to work for me.

I had the issue as well, I deleted /Users/{yourUserName}/Library/Developer/Xcode/DerivedData and rebuilded everything, solved it.

I am having the similar error in android too, How can I fix it? I have already tried deleting node_modules and relinking.
React-vative version: 0.46.0

I'm only getting this error when I try to build for production. I tried removing DerivedData and rm -rf ios/build/* but so far I'm out of luck.

[error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 's.IsAndroid') [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 's.IsAndroid') [error][tid:com.facebook.react.JavaScript] this._lazyCallableModules[e] is not a function. (In 'this._lazyCallableModules[e]()', 'this._lazyCallableModules[e]' is undefined)

RN Version 0.46.4

you need run react-native link react-native-sound

I have this problem running test cases from Jest. Works fine in emulators and hardware for both Android and iOS.

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"

@justinTime225 it sounds like you are using a native java project and not react project, is that not the case?

@trepidity I am using react-native. I am trying to launch it on the android emulator using android studio. The app launches perfectly when I do react-native run-ios but not for android studio.

I am running into the same issue as @justinTime225 was running into.

Compiles fine in react-native run-ios but not for react-native run-android

iOS app crashing, built for release on device.
Framework linked properly, derived data deleted.
Same error on app launch than everyone.

^ seconded

Getting this issue in iOS simulator, Framework linked, derived data deleted.
Working fine on Android Device.

Edit: react-native link did nothing, had to do manual install for iOS/ Xcode, recompiled and it worked.

Have a look at https://github.com/zmxv/react-native-sound/issues/36#issuecomment-284443489 -- this works for me

Had exactly the same problem. Cleaning the project (Product->Clean) in Xcode surprisingly helped :-)

I am getting a similar error:
"Uncaught Error: undefined is not an object (evaluating 'r.IsAndroid')"
The project works fine on my android emulator when I run 'react-native run-android', but when I loaded it onto google play and ran it in test mode I get this error on my phone.

Restarting the React Packager did it for me

FYI ... https://docs.expo.io/versions/v17.0.0/sdk/audio.html great stuff for expo users!

for newcomers using expo try https://docs.expo.io/versions/latest/sdk/audio

You can use manual linking in order to solve this problem.

Make sure that you run pod install after react-native link react-native-sound in case you are use pods. In other case link it manually https://github.com/zmxv/react-native-sound/issues/36#issuecomment-284443489

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.

So basically you're closing an issue because "it works for me".
That's not how things works you know?

To elaborate, this isn't something that will be fixed by a code change in the library. Rather it's a tooling issue that manifests in a lot of different ways depending on people's setup. If you search the issues for IsAndroid and read the threads you'll see there isn't a single fix that works for everyone.

Apart from collecting all the workarounds in one place, the only other thing that can be done is to troubleshoot someone's specific situation, which is better done at the time they're experiencing the problem.

I'll open a new issue for the doc update.

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.

I don't understand what does it mean "running pod install"?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gastonmorixe picture gastonmorixe  路  4Comments

LCD344 picture LCD344  路  5Comments

andrekovac picture andrekovac  路  5Comments

nfq6612 picture nfq6612  路  3Comments

ya-watanabe picture ya-watanabe  路  4Comments