简体   繁体   中英

Getting error on MainActivity.java when running react-native run-android

I'm running react-native run-android and I'm getting this error when compiling.

:app:compileDebugJavaWithJavac - is not incremental (eg outputs have changed, no previous execution, etc.)

MainActivity.java:37: error: method does not override or implement a method from a supertype @Override ^ 1 error :app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

I really don't know how to proceed so any suggestion is really welcome.

I have installed:

  • javac 1.8.0_101
  • react-native-cli: 1.0.0
  • react-native: 0.32.0

EDIT

This is the MainActivity.java

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 "netbeast";
    }

    /**
     * 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  **//This is the line 37 where the error occurs**
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new VectorIconsPackage(),
            new UdpSocketsModule(),
            new RNNetworkInfoPackage()
        );
    }
}

尝试运行react-native upgrade,这将更新mainActivity.java。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM