Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'IsAndroid' of undefined #215

Closed
findzen opened this issue Jun 26, 2017 · 31 comments
Closed

Cannot read property 'IsAndroid' of undefined #215

findzen opened this issue Jun 26, 2017 · 31 comments

Comments

@findzen
Copy link

findzen commented Jun 26, 2017

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"
  }
@benvium
Copy link
Collaborator

benvium commented Jun 26, 2017

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

@findzen
Copy link
Author

findzen commented Jun 26, 2017

Yep

@gasparteixeira
Copy link

gasparteixeira commented Jun 28, 2017

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

@gasparteixeira
Copy link

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

@jpapillon
Copy link

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

@JimSchofield
Copy link

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

@MPieter
Copy link

MPieter commented Jun 30, 2017

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

@divyam3897
Copy link

divyam3897 commented Jul 7, 2017

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

@jpapillon
Copy link

@divyam3897 #215 (comment)

@baldurpan
Copy link

baldurpan commented Jul 19, 2017

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

@LeeZC
Copy link

LeeZC commented Jul 24, 2017

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

@dominictracey
Copy link

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

@gvenk
Copy link
Contributor

gvenk commented Aug 30, 2017

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

@justinTime225
Copy link

justinTime225 commented Sep 8, 2017

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"

@trepidity
Copy link
Collaborator

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

@justinTime225
Copy link

@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.

@JperF
Copy link

JperF commented Oct 13, 2017

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

@tirrorex
Copy link

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

@jchirik
Copy link

jchirik commented Dec 3, 2017

^ seconded

@devagul93
Copy link

devagul93 commented Dec 7, 2017

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.

@mikeknapp
Copy link
Contributor

Have a look at #36 (comment) -- this works for me

@RassaLibre
Copy link

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

@MichaelRomani
Copy link

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.

@SamiChab
Copy link

Restarting the React Packager did it for me

@marcelobbfonseca
Copy link

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

@abhi-nahi
Copy link

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

@vladbars
Copy link

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 #36 (comment)

@paulmelnikow
Copy link
Collaborator

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.

@tirrorex
Copy link

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

@paulmelnikow
Copy link
Collaborator

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.

@Cat107
Copy link

Cat107 commented May 6, 2020

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"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests