簡體   English   中英

運行react-native run-android時,在MainActivity.java上出錯

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

我正在運行react-native run-android ,我在編譯時遇到了這個錯誤。

:app:compileDebugJavaWithJavac - 不是增量的(例如輸出已更改,之前沒有執行等)

MainActivity.java:37:error:方法不會覆蓋或實現超類型@Override ^ 1錯誤的方法:app:compileDebugJavaWithJavac FAILED

FAILURE:構建因異常而失敗。

我真的不知道怎么辦,所以任何建議都非常受歡迎。

我安裝了:

  • javac 1.8.0_101
  • react-native-cli:1.0.0
  • 反應原生: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 upgrade,這將更新mainActivity.java。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM