我在Windows 10上運行react-native,我遇到了一堆問題。 首先,在項目的根目錄下,當我運行Windows 10反應原生android問題
react-native run-android
我得到這個錯誤:
JS server already running. Building and installing the app on the device (cd android && gradlew.bat installDebug... Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/android-setup.html
而且隨着--stacktrace --info沒有幫助運行它。 然後我決定做手工運行Android的腳本似乎什麼是試圖通過進入Android的目錄,以實現和運行
cd android && gradlew.bat installDebug
建立我自認爲,產生了一堆的結果,但在錯誤仍然結束。
:app:compileDebugJavaWithJavac :app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.). C:\Users\jiangyaokai\workspace\maincourse\android\app\src\main\java\com\maincourse\MainApplication.java:30: error: cannot find symbol new CodePush(this.getResources().getString(R.strings.reactNativeCodePush_androidDeploymentKey), this, BuildConfig.DEBUG), ^ symbol: variable strings location: class R C:\Users\jiangyaokai\workspace\maincourse\android\app\src\main\java\com\maincourse\MainApplication.java:30: error: cannot find symbol new CodePush(this.getResources().getString(R.strings.reactNativeCodePush_androidDeploymentKey), this, BuildConfig.DEBUG), ^ symbol: method getResources()
2 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: 8.109 secs
我在想我在做什麼錯?謝謝。
但它似乎不僅僅是CodePush,R.strings也有問題,如果它只是CodePush,那麼我可以刪除它,但事實並非如此。我只是想知道R.strings如何不被識別。 – user1380898
@ user1380898嘗試'android /'裏面的'gradlew clean'。 –
@Baja對於這個'gradlew clean',不夠感謝。 – Rudy