react-native-share-extension: Android Build error "method does not override or implement a method from a supertype"

Hi @alinz – I tried to start a fresh new RN project and use the extension, but when I attempt to build it with ‘react-native run-android’, I keep getting the error:

:react-native-share-extension:compileReleaseJavaWithJavac
:react-native-share-extension:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/NEW_RN_APP/node_modules/react-native-share-extension/android/src/main/java/com/github/alinz/reactNativeShareExtension/ShareExActivity.java:78: error: method does not override or implement a method from a supertype
    @Override
    ^
1 error
:react-native-share-extension:compileReleaseJavaWithJavac FAILED

Are you familiar with this error or how I might troubleshoot it? Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@allenrl yes that is true. The bootstrap api for Android has been changed significantly. I will update the code soon. Once I push the code I will close this ticket.

update: don’t know if this is just a coincidence or the cause, but RN just pushed a new update v 0.29.0 just a few days ago that might explain why this error happened when I just generated a new RN app yesterday and installed your extension. the update creates a new file MainApplication.java that contains some code similar to what it was complaining about during the build (@Override protected List<ReactPackage> getPackages()).
v 0.29.0 Update Release Notes: https://github.com/facebook/react-native/releases/tag/v0.29.0

quote:

Android

Change the application template (49f20f4) - @foghina

Plugins which pass activity reference in the constructor need to be updated to extend ReactContextBaseJavaModule use getCurrentActivity to get the activity reference. This change is backward compatible. Apps need to be migrated to use the latest template Migration instructions for apps

  1. Create a new file MainApplication.java in the same folder as MainActivity.java
  2. Update it to match - https://github.com/facebook/react-native/blob/0.29-stable/local-cli/generator-android/templates/package/MainApplication.java and move your customisations from MainActivity.java to this file
  3. Update MainActivity.java to match - https://github.com/facebook/react-native/blob/0.29-stable/local-cli/generator-android/templates/package/MainActivity.java

+1. Still waiting for update.