java - 运行react-native run-android 时MainActivity.java 出现错误

标签 java android react-native

我正在运行 react-native run-android 并且在编译时收到此错误。

:app:compileDebugJavaWithJavac - is not incremental (e.g. 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.

我真的不知道如何继续,所以非常欢迎任何建议。

我已经安装了:

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

编辑

这是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升级,这将更新mainActivity.java。

关于java - 运行react-native run-android 时MainActivity.java 出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39278030/

相关文章:

java - 删除 Android webview 左右边距

React-native JS 调试器与 CORS 相关的问题 — iOS

android - 如何减少水平 Flatlist 中项目之间的空间

java - Sap hana 无效的表名

java - 如何在不支持 GUI 的 headless Linux 上运行 Java GUI 应用程序?

javascript - 在 ParseInstallation 对象中包含用户名是不是一种不好的形式?

java - 如何让Alarm BootReceiver在特定时间发送通知?

android - 在 RecyclerView 项目中显示动态数量的 View ?

react-native - 嵌套的 Drawer-StackNavigator,触发 "DrawerOpen"不适用于 React-Native

java - CountDownTimer 取消()不工作