Search code examples
androidangulargradleionic-frameworkcapacitor

Ionic Live Reload Capacitor Gradle build - failed! Unable to locate a Java Runtime


Live Reload not working anymore?

Now after the update to Capacitor Version 3 I can't use Live Reload in my Ionic Angular Project anymore. Unable to locate a Java Runtime. Has anyone else got the same issue?

I've followed the official Capacitor guide, also installed the native-run from ionic/cli. https://capacitorjs.com/docs/guides/live-reload#live-reload

Its not working!


This is the console error:

capacitor run android --no-sync --target LMQ610PJNVDUJV6TCQ

[capacitor] ✖ Running Gradle build - failed!

[capacitor] [error] The operation couldn’t be completed. Unable to locate a Java Runtime.

[capacitor] Please visit http://www.java.com for information on installing Java. [capacitor] [ERROR] An error occurred while running subprocess capacitor.

capacitor run android --no-sync --target LMQ610PJNVDUJV6TCQ exited with exit code 1.

Anybody got an idea what's the issue? Do I really need to install Java on Mac?? Thank you!!


Solution

  • A little late, but I had the same problem - this was the solution someone found (specific to AndroidStudion on MacOS) about a week ago: https://forum.ionicframework.com/t/unable-to-locate-a-java-runtime-error-when-building-for-android-on-mac/221148

    Follow these instructions closely - you don't want to install Java, you want to use the Java installation embedded inside AndroidStudio, which has all the ADK libraries and licenses already accepted.

    Honestly, this only fixes the gradle-build problem of not being able to find Java, and isn't specifically about live-reload - but it was certainly preventing live-reload.