react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Android build error with [email protected]

Open jpapillon opened this issue 10 years ago • 42 comments

I get this error when building with [email protected]:

node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:64: error: method does not override or implement a method from a supertype
    @Override
    ^
1 error

Quick link to line

jpapillon avatar Jul 27 '16 13:07 jpapillon

I'm having the same error.

SpaceK33z avatar Jul 27 '16 15:07 SpaceK33z

Are you using other external packages that require push? Like Firebase?

rturk avatar Jul 27 '16 16:07 rturk

@rturk, good idea, I disabled all other external packages. Unfortunately the error is still present.

SpaceK33z avatar Jul 27 '16 17:07 SpaceK33z

Same. I'm encountering this error with rn 0.30.0 and 2.0.2 of the app. Has anyone gotten this to work correctly?

skunkworker avatar Jul 28 '16 02:07 skunkworker

same here

finalquest avatar Jul 28 '16 19:07 finalquest

Rolling back to 2.0.1 fixed it for now, while still being on rn 0.30.0 "react-native-push-notification": "2.0.1"

skunkworker avatar Jul 28 '16 21:07 skunkworker

Had this problem also, had to

npm cache clear
rm -Rf node_modules
npm install

After than 2.0.2 + rn 0.30.0 works properly.

clintonjrobinson avatar Jul 28 '16 21:07 clintonjrobinson

I'm having the same error :( : "react-native": "^0.30.0", "react-native-push-notification": "^2.0.1"

error: method does not override or implement a method from a supertype @Override ^

ssancheza227 avatar Aug 04 '16 21:08 ssancheza227

Did you guys all upgrade from a previous version of RN? For me the error was fixed after I ran react-native upgrade, and made sure all files in android/ were up-to-date.

SpaceK33z avatar Aug 05 '16 12:08 SpaceK33z

I tried [email protected] with 2.0.2 (commit #0b019670) and it requires to remove the @Override keyword and leave the onNewIntent function where it is.

jpapillon avatar Aug 05 '16 19:08 jpapillon

Re-running the upgrade, and ensuring I got everything, worked for me.

jamespearson avatar Aug 08 '16 08:08 jamespearson

Everything is updated and this is the error I get trying to compile it with [email protected]:

./node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:64: error: method does not override or implement a method from a supertype
    @Override
    ^
1 error
:react-native-push-notification:compileReleaseJavaWithJavac FAILED

jpapillon avatar Aug 15 '16 15:08 jpapillon

I found out that my configuration in ./android/build.gradle was not correctly set. It needs to be set to: url "$rootDir/../node_modules/react-native/android" instead of url "$projectDir/../../node_modules/react-native/android"

jpapillon avatar Aug 15 '16 18:08 jpapillon

I have the same issue on 0.33-rc but it works on 0.32. Not sure what it's coming from...

cosmith avatar Sep 07 '16 16:09 cosmith

I am getting this with RN0.33.0 and neither rn upgrade nor nuking node_modules solved this.

julienvincent avatar Sep 10 '16 11:09 julienvincent

I've solved this by opening project in Android studio. Open RNPushNotification.java. Hit Ctrl+I (Implement methods). Choose onActivityResult. Delete former onActivityResult and save.

mauron85 avatar Sep 10 '16 12:09 mauron85

I looked at your commit - as far as I can see, nothing was actually changed except some new lines. Not sure how that is going to fix this issue?

julienvincent avatar Sep 10 '16 12:09 julienvincent

@julienvincent that is actually the strange part. Compiler was complaining about not implementing method onActivityResult. So I've opened Android Studio -> implements method. It created new method onActivityResult and I deleted old declaration. Compiler was happy. And just after that I've realised the method declaration is same, so actually only empty lines were added. Very strange. However when I install module from npm, it happens again.

/Users/finch/dev/mapilary/Courier/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:30: error: RNPushNotification is not abstract and does not override abstract method onActivityResult(Activity,int,int,Intent) in ActivityEventListener
public class RNPushNotification extends ReactContextBaseJavaModule implements ActivityEventListener {
       ^
../node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:168: error: method does not override or implement a method from a supertype
    @Override
    ^
2 errors

mauron85 avatar Sep 10 '16 12:09 mauron85

Ok. I've found that npm version is not same as master on github (but version numbers are the same). I've only checked build.gradle and it differs. Maybe that is the reason. Installed from github instead of npm and no compilation error occured.

So I would say npm version should be reuploaded.

mauron85 avatar Sep 10 '16 12:09 mauron85

The github version would differ due to the repo owner doing additional work on the project since last release. But I agree, it would be nice if @zo0r could release a new patch version to fix this problem. In the meantime I have found that using 2.0.1 does indeed fix this as mentioned by @skunkworker.

julienvincent avatar Sep 10 '16 12:09 julienvincent