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

undefined is not an object (evaluating 'RNSound.setLooping') #23

Closed
Shakarang opened this issue Mar 18, 2016 · 4 comments
Closed

undefined is not an object (evaluating 'RNSound.setLooping') #23

Shakarang opened this issue Mar 18, 2016 · 4 comments

Comments

@Shakarang
Copy link

Hello, I have the same problem as another had before but on Android platform.

I use React 0.21 and Android Api 22.

@jenbennings
Copy link

I'm also experiencing this issue on 0.21.

@jenbennings
Copy link

@Shakarang Did you upgrade react-native recently? I just tried running through the installation steps (linking it in Xcode etc.) and this seems to have fixed it.

@Shakarang
Copy link
Author

Hello,
I juste upgraded one hour ago. On iOS it works fine, but on android now I've got "undefined is not a function (evaluating 'RNSound.enable(enabled)')

I'm new to React and I don't know, maybe I've done something wrong. I've correctly followed your explanations for settings.gradle and build.gradle but in my MainActivity I don't have the OnCreate method preset but I've getPackages() method. Si here is my main :
`public class MainActivity extends ReactActivity {

/**
 * Returns the name of the main component registered from JavaScript.
 * This is used to schedule rendering of the component.
 */
@Override
protected String getMainComponentName() {
    return "ReactTest";
}

/**
 * Returns whether dev mode should be enabled.
 * This enables e.g. the dev menu.
 */
@Override
protected boolean getUseDeveloperSupport() {
    return BuildConfig.DEBUG;
}

/**
 * A list of packages used by the app. If the app uses additional views
 * or modules besides the default ones, add more packages here.
 */
@Override
protected List<ReactPackage> getPackages() {
    return Arrays.asList(
            new MainReactPackage(),
            new RNSoundPackage()
    );
}

}
`
I'm also testing on GenyMotion device. Can this be the source of my problems?

@zmxv zmxv closed this as completed in ee0125b Apr 6, 2016
@peternann
Copy link

It appears you have followed the README accurately, and you have added the getPackages method into MainActivity.java

The README seems wrong (at the time of typing).
Doco here indicates the correct class to add to is MainApplication.java:
http://facebook.github.io/react-native/docs/native-modules-android.html

I moved it, and things finally started to work.

Please correct the README ASAP. Shitty trap for new users...

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

No branches or pull requests

3 participants