React-native-onesignal: cannot find symbol "ReactNativeOneSignalPackage"

Created on 7 Jan 2017  路  6Comments  路  Source: OneSignal/react-native-onesignal

I'm on RN=0.39 and I've installed many other libraries flawlessly, for iOS and Android.

I did "react-native link" as well as followed all the instructions in the README.

I'm getting the error below, please advise.

import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
                                      ^
  symbol:   class ReactNativeOneSignalPackage
  location: package com.geektime.rnonesignalandroid
/Users/giro/stardust-app/android/app/src/main/java/com/stardust/MainApplication.java:41: error: cannot find symbol
            new ReactNativeOneSignalPackage(),
                ^
  symbol: class ReactNativeOneSignalPackage
2 errors

Most helpful comment

Seconded, I managed to solve this by doing:

  • npm install --save react-native-onesignal
  • react-native link react-native-onesignal
  • Change the import in MainApplication.java to be import com.geektime.reactnativeonesignal.ReactNativeOneSignalPackage;

All 6 comments

Seconded, I managed to solve this by doing:

  • npm install --save react-native-onesignal
  • react-native link react-native-onesignal
  • Change the import in MainApplication.java to be import com.geektime.reactnativeonesignal.ReactNativeOneSignalPackage;

In your MainApplication.java replaceimport com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage; with com.geektime.reactnativeonesignal.ReactNativeOneSignalPackage. Make sure that the old import is gone. (This was my issue initially)

Newest version solves this problem and support react-native link out of the box.
Thanks for reporting!

@avishayil I'm also receiving this error while building Android while testing out PR #184. Also confirmed it's happening on master. I also made sure I'm following the fixes in the above posts. I'm also using react-native 0.41. Any ideas on this?

Hi,

i checked android example and import package is different from example code;

i used this package and it compiled;
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;

i hope, it'll work for you.

in the android/app/build.gradle at dependencies you must add this line to read package.

dependencies { 
    ...............
    compile project(':react-native-sound-player')
}

it will be working ;)

Was this page helpful?
0 / 5 - 0 ratings