尝试在 Windows 10 上为我的 React Native 项目安装 NativeBase时遇到以下问题
react-native init RNapp
cd RNapp
npm install native-base --save
react-native link react-native-vector-icons
- 编辑
android/app/build.gradle
并将以下内容添加到文件末尾:
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
运行echo %JAVA_HOME%
给C:\Program Files\Java\jdk1.8.0_111
现在当我跑
react-native run-android
构建失败并出现以下错误。这个问题有解决方案吗?
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:6: error: cannot find s
mbol
import com.facebook.react.ReactApplication;
^
symbol: class ReactApplication
location: package com.facebook.react
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:9: error: cannot find s
mbol
import com.facebook.react.ReactNativeHost;
^
symbol: class ReactNativeHost
location: package com.facebook.react
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:17: error: cannot find
ymbol
public class MainApplication extends Application implements ReactApplication {
^
symbol: class ReactApplication
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:19: error: cannot find
ymbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:35: error: cannot find
ymbol
public ReactNativeHost getReactNativeHost() {
^
symbol: class ReactNativeHost
location: class MainApplication
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainActivity.java:5: error: MainActivity is
ot abstract and does not override abstract method getPackages() in ReactActivity
public class MainActivity extends ReactActivity {
^
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:19: error: cannot find
ymbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
C:\Users\y\RNapp\android\app\src\main\java\com\rnapp\MainApplication.java:34: error: method does
ot override or implement a method from a supertype
@Override
^
8 errors
:app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.098 secs