Issue
1. Summarize the problem
I joined in the middle of developing an application through react native so I tried to compile on Android emulator.
When I run $ react-native run-android
,the emulator works but the app is not installed.
The build works fine on other team members' laptops, but not on mine.
The error message is:
MacBook-Pro-3:react-native-starter seunghyunwoo$ react-native run-android
warn Your project is using deprecated "rnpm" config that will stop working from next release. Please use a "react-native.config.js" file to configure the React Native CLI. Migration guide: https://github.com/react-native-community/cli/blob/master/docs/configuration.md info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 1638 file(s) to forward-jetify. Using 8 workers... info Starting JS server... * daemon not running; starting now at tcp:5037 * daemon started successfully info Launching emulator... info Successfully launched emulator. info Installing the app... Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
What went wrong: Could not open settings remapped class cache for po6n8851p0t5646j48cpt24i (/Users/seunghyunwoo/.gradle/caches/5.5/scripts-remapped/settings_7eu19g7uwjl23ikwbk0j0slts/po6n8851p0t5646j48cpt24i/settings74e694b976d6abaa826c8abac43e9de8).
Could not open settings generic class cache for settings file '/Users/seunghyunwoo/mecute/playground/react-native-starter/android/settings.gradle' (/Users/seunghyunwoo/.gradle/caches/5.5/scripts/po6n8851p0t5646j48cpt24i/settings/settings74e694b976d6abaa826c8abac43e9de8). BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 57
Try: Run 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.
Get more help at https://help.gradle.org
BUILD FAILED in 3s
error 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. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong: Could not open settings remapped class cache for po6n8851p0t5646j48cpt24i (/Users/seunghyunwoo/.gradle/caches/5.5/scripts-remapped/settings_7eu19g7uwjl23ikwbk0j0slts/po6n8851p0t5646j48cpt24i/settings74e694b976d6abaa826c8abac43e9de8).
Could not open settings generic class cache for settings file '/Users/seunghyunwoo/mecute/playground/react-native-starter/android/settings.gradle' (/Users/seunghyunwoo/.gradle/caches/5.5/scripts/po6n8851p0t5646j48cpt24i/settings/settings74e694b976d6abaa826c8abac43e9de8). BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 57
Try: Run 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.
Get more help at https://help.gradle.org
BUILD FAILED in 3s
at checkExecSyncError (child_process.js:611:11)
at execFileSync (child_process.js:629:15)
at runOnAllDevices (/Users/seunghyunwoo/mecute/playground/react-native-starter/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (/Users/seunghyunwoo/mecute/playground/react-native-starter/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:164:9)
2. Describe what you’ve tried
I remove caches directory and files in it but errors still occured. Here's my environment:
System:
OS: macOS 10.15.2
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 94.54 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries: Node: 13.8.0 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.13.6 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 IDEs: Android Studio: 3.5 AI-191.8026.42.35.6010548 Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild npmPackages: react: 16.12.0 => 16.12.0 react-native: 0.61.5 => 0.61.5 npmGlobalPackages: react-native-cli: 2.0.1
How can I fix this? please help
Solution
I solved this by installing JDK 8. I was experiencing this issue with JDK 13.
You can remove current installed JDK with (MacOS):
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk<version>.jdk
Then go to the official Oracle download page (you need to create an account):
Answered By - miqrc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.