Search code examples
react-nativegeolocation

Error with android build while using react-native-community_geolocation


I am using the react-native-community_geolocation package. On my IOS simulator evertging works fine but on android I keep getting a build failed.

This is the error that I get:

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':react-native-community_geolocation'.

Could not open cp_proj generic class cache for build file '/Users//Desktop//node_modules/@react-native-community/geolocation/android/build.gradle' (/Users/*****/.gradle/caches/7.5.1/scripts/e08foxj1bhjhq63aa1rz2tkj3). BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 63

Can anyone help?? I can find anything on Google


Solution

  • Fix Java Error - Unsupported class file major version XX The Unsupported Class File Major Version XX error indicates that the version of the Java class file that you are trying to run is not supported by the current version of the Java runtime environment (JRE) you have installed on your system.

    In other words, the class file that you are trying to run was compiled using a more recent version of Java than the one you have installed.

    The Unsupported Class File Major Version XX error can be fixed by updating the Java runtime environment to the latest version and ensuring that any libraries or dependencies used by the Java program are compatible with the updated JRE

    In case of React Native we need to have Java 11

    brew tap homebrew/cask-versions
    brew install --cask zulu11