![](/img/trans.png)
[英]Can not find symbol in MainActivity.java React-native Android
[英]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:構建因異常而失敗。
我真的不知道怎么辦,所以任何建議都非常受歡迎。
我安裝了:
編輯
這是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.