【发布时间】:2016-09-02 02:34:49
【问题描述】:
我正在运行react-native run-android,编译时出现此错误。
:app:compileDebugJavaWithJavac - 不是增量的(例如输出已更改,之前没有执行等)
MainActivity.java:37:错误:方法没有覆盖或实现超类型中的方法 @覆盖 ^ 1 个错误 :app:compileDebugJavaWithJavac 失败
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()
);
}
}
【问题讨论】:
-
检查编译器抱怨的 mainActivity.java 中的第 37 行。
-
我已经添加了 mainActivity.java 文件 ;)
-
第 37 行是哪一行?我不认为我在您的代码示例中看到总共 37 行。
标签: java android react-native