question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

method does not override or implement a method from a supertype @Override

See original GitHub issue

i have updated react-native version from 0.44.0 to 0.48.1, after which i am unable to make a build. it is giving this error

myapp\node_modules\react-native-device-info\android\src\main\java\com\learnium\RNDeviceInfo\RNDeviceInfo.java:26: error: method does not override or implement a method from a supertype
  @Override                                                          
  ^
1 error                                                              
:react-native-device-info:compileReleaseJavaWithJavac FAILED         

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-device-info:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:36

github_iconTop GitHub Comments

35reactions
MacKentochcommented, Oct 22, 2017

It is a known issue easy fixed.

It is due to a RN breaking change so just remove @Override in RNDeviceInfo.java

What is wrong:

public class RNDeviceInfo implements ReactPackage {

  @Override
  public List<NativeModule> createNativeModules(
                              ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new RNDeviceModule(reactContext));

    return modules;
  }

  @Override
  public List<Class<? extends JavaScriptModule>> createJSModules() {
  	return Collections.emptyList();
  }

  @Override
  public List<ViewManager> createViewManagers(
                            ReactApplicationContext reactContext) {
  	return Collections.emptyList();
  }

}

replace with:

public class RNDeviceInfo implements ReactPackage {


  public List<NativeModule> createNativeModules(
                              ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new RNDeviceModule(reactContext));

    return modules;
  }


  public List<Class<? extends JavaScriptModule>> createJSModules() {
  	return Collections.emptyList();
  }


  public List<ViewManager> createViewManagers(
                            ReactApplicationContext reactContext) {
  	return Collections.emptyList();
  }

}
10reactions
alexeyMohnatkincommented, Sep 13, 2017

try yarn upgrade react-native-device-info It solved the issue for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - method does not override or implement a method from a ...
The problem is what the error message is saying: "the method does not override or implement a method from a supertype". You annotated...
Read more >
error: method does not override or implement a ... - Treehouse
The problem here is the @Override annotation and the concept of inheritance. Just as we inherit genes from our parents, classes inherit fields ......
Read more >
method does not override or implement a meth - java help on ...
The Snake class must have a public void move() method. · The SnakeGame class must override the Game parent class's onTurn(int) method. ·...
Read more >
"method does not override or implement a method ... - Reddit
If I remove override, as someone suggested, I would get another error, since the method is already in "funcionario" so I shouldn't even...
Read more >
What is @Override? Fix method does not override ... - YouTube
What is @ Override ? Fix method does not override or implement a method from a supertype.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found