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

Created on 25 Jan 2018  路  19Comments  路  Source: zmxv/react-native-sound

"react": "^16.2.0",
"react-native": "^0.51.0"
it is my package version,i found Cannot read property 'IsAndroid' of undefined this error on android ,can you help me!

build question

Most helpful comment

Solved by adding permission in manifest file

is the record_audio permission??

All 19 comments

On iOS emulator:
"react": "16.2.0",
"react-native": "^0.51.0",
"react-native-sound": "^0.10.4",

The same issue.

The same issue appears on android with "react": "16.0.0", "react-native": "0.50.3",

I had this issue, you can try to do:

cd ios
pod install

and then try to compile and run again

Also happened to me, deleting the app and reinstalling worked for me, may be a problem with the linking

Having the same issue with
"react": "16.0.0-beta.5",
"react-native": "0.49.3",
"react-native-sound": "^0.10.5",

react-native link react-native-sound fixed it..

@zkeyword are you good to go now?

I'm having the same error in iOS hardware:

    "react": "^16.3.0-alpha.1",
    "react-native": "0.54.2",
    "react-native-sound": "0.10.9"

I installed via react-native link

I can confirm this issue as well. Neither pod install or running link solves it.

Steps to fix:

1) Install the module as documented in the readme of this repo
2) If you deploy to iOS then cd to ios and run pod install
3) Go to your test device and DELETE the app from it if you have ever deployed it there before
4) Compile the app and run it on your device (e.g. go to xcode for ios or android studio for android) and compile and deploy to your device
5) Once a new version of the app is on your device it will work

The reason for this is pretty simple if you think about it. Whenever you install a new module that uses native code extensions the app you have previously deployed to your device will NOT contain that code so needs to be recompiled and re-deployed to the device. Simply refreshing the existing app only refreshes the JavaScript code, not any native underlying app code on the device.

聽聽+1
(@Irrelon tried your suggestion, but it did not work for me :/)

after install module

  1. react-native link
    and
  2. cd ios
    pod install

makes working perfect

on Android:
I have The same issue.

so : I Compile the app.
after, compile error: " can't find new RNSoundPackage(), "

I According to Manual Installation
auto link don't have this : import com.zmxv.RNSound.RNSoundPackage; // <-- New

add it to MainApplication.java
it works for me

Try to check if the linking is performed correctly. I encountered the same issue on iOS and resolved it by performing the linking manually:

  1. Add RNSound.xcodeproj to Libraries
  2. Go to your app target > General > Linked Frameworks and Libraries. Add libRNSound.a there.
  3. Restart packager

I have the issue on android. "Cannot read property 'IsAndroid' of undefined"
"react": "^16.8.4", "react-art": "^16.8.4", "react-dom": "^16.8.4", "react-native": "0.58.6", "react-native-sound": "^0.10.12",

Linking is showing as linked

Solved by adding permission in manifest file

Solved by adding permission in manifest file

is the record_audio permission??

I had resolved it by adding code in main application - like .addpackage(...sound)

Hi! If you're still having this problem, could you please post a link to a project that reproduces the problem, give information about your environment, and say what steps you have already tried?

This is the most common issue faced by react-native-sound users and it would be good to add documentation listing the possible resolutions. A pull request would be welcome; I've opened #592 to track that.

Was this page helpful?
0 / 5 - 0 ratings