発生している問題・エラーメッセージ
公式のガイド通り、ReactNativeのローカル開発環境を構築している途中、ReactNativeのサンプルプロジェクト(Awesome)をiOS、またはAndroidのエミュレーターでRunさせると、それぞれサーバーに接続できない旨のエラーを表示しました。
iOS
1Could not connect to development server 2~以下イメージ
Android
1Awesome$ npx react-native run-android 2~省略~ 31 error 4* Try: 5Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. 6* Get more help at https://help.gradle.org 7BUILD FAILED in 3s 8error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. 9Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 10FAILURE: Build failed with an exception. 11* Where: 12Settings file '/Users/home/Awesome/android/settings.gradle' 13* What went wrong: 14Could not compile settings file '/Users/home/Awesome/android/settings.gradle'. 15> startup failed: 16 General error during semantic analysis: Unsupported class file major version 57
試したこと
エミュレーター自体に問題があるのかを確かめるため、事前に入れていたFlutterで新規プロジェクトを作成して、iOS,Androidそれぞれの環境で動かしてみると、問題なく動きました。
補足情報(FW/ツールのバージョンなど)
ReactNative-3.2.0
Xcode-11.3.1
Android Studio-3.6
あなたの回答
tips
プレビュー