- node version v16.14.2
- react 17.0.2 -react-native 0.68.2 I can run the app with '$npm start' using the expo quickstart method. I've have tried every solution I can find but I am clearly missing something. Running '$npx react-native run-android' however gives me the following errors
Task :react-native-gradle-plugin:compileKotlin FAILED 'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version. 1 actionable task: 1 executed
Execution failed for task ':react-native-gradle-plugin:compileKotlin'.
Failed to query the value of task ':react-native-gradle-plugin:compileKotlin' property 'compilerRunner$kotlin_gradle_plugin'. Kotlin could not find the required JDK tools in the Java installation. Make sure Kotlin compilation is running on a JDK, not JRE.
When I run '$npx react-native doctor I get the following results:
Common ✓ Node.js ✓ npm
Android
✖ JDK
- Version found: N/A
- Version supported: 1.8.x || >= 9
✖ Android Studio - Required for building and installing your app on Android
✖ Android SDK - Required for building and installing your app on Android
- Versions found: N/A
- Version supported: 31.0.0
✖ ANDROID_HOME
I know I have these installed but I'm unsure why they can't be found. Here is my .bash_profile as well.
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH=$PATH:/home/alex/.nvm/versions/node/v16.14.2/bin
export ANDROID_SDK_ROOT=$HOME/alex/Android/Sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export ANDROID_HOME=$HOME/alex/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
eval "$(rbenv init -)"
I appreciate the help.
FIXED Link to stackoverflow question that solved this for me. SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable
I added a 'local.properties' file in my root android folder with :
sdk.dir = /home/USERNAME/Android/Sdk
After thatrunning $npx react-native run-android worked