2016-08-19 10 views
-1

私はWindows 10でreact-nativeを実行していますが、私はたくさんの問題を抱えています。 まず、プロジェクトのルートディレクトリで、私はWindows 10での反応がネイティブなアンドロイドの問題

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のディレクトリに行くことによって達成し、結果の束を生成するが、それでもエラーで終了したことを

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

私は何が間違っているのだろうか?ありがとう。ここで

答えて

1

はあなたのエラーメッセージからの抜粋です:

MainApplication.java:30: error: cannot find symbol new CodePush(this.getResources().getString(R.strings.reactNativeCodePush_androidDeploymentKey), this, BuildConfig.DEBUG),^symbol: method getResources() 

それはあなたが使用しているCodePushプラグインとは何かを持っているように見えます。

ここで設定手順に従ってください:https://github.com/Microsoft/react-native-code-push#android-setupして、もう一度お試しください。

+0

しかしCodePushだけでなく、R.stringsも問題を抱えているようですが、CodePushだけであれば削除できましたが、そうではありません。私はR.stringsがどのように認識されないのだろうかと思っています。 – user1380898

+1

@ user1380898 'android /'の内部で 'gralew clean 'を試してください。 –

+0

@Bajaこの 'gradlew clean'のために十分にあなたに感謝することはできません。 – Rudy

0

解決済み。

シンボル:変数ストリング場所:クラスR

これは、Rは、文字列のみではなく、文字列、コードは、(自動生成された)文字列を意味する理由がわからないを持っていることに起因します。

シンボル:メソッドgetResources()

これが欠けている「これは」内部クラス、のwheres getResources(を指すため)だけ外側のクラスに見出されます。

全体的に、基本的にコードは間違っており、正しくコンパイルできませんでした。

ありがとうございます。

関連する問題