Error trying to use LiveReload

Hi! I have my first app running in Ionic but now I need to run into my device because it is a databse app SQLITE so far so good using Android Studio to debug and use it but now I wanna use LiveReload to see the changes live in my device.
My device is connected by USB and it works fine when I use AndroidStudio but I get an error when I try to use LiveReload

PS C:\dev\Angular\mylogin> ionic capacitor run android -l --external
? Which device would you like to target? (Use arrow keys)
> Alcatel 5041C (JB5HHYAAY5IZKN4P)
Pixel_3a_API_33_x86_64 (emulator) (Pixel_3a_API_33_x86_64)
Pixel 4 API 33 (emulator) (Pixel_4_API_33)
Pixel_5_API_33 (emulator) (Pixel_5_API_33_1)

capacitor.cmd run android --no-sync --target JB5HHYAAY5IZKN4P
[capacitor] × Running Gradle build - failed!
[capacitor] [error]
[capacitor] FAILURE: Build failed with an exception.
[capacitor]
[capacitor] * What went wrong:
[capacitor] A problem occurred configuring root project ‘android’.
[capacitor] > Could not resolve all files for configuration ‘:classpath’.
[capacitor] > Could not resolve com.android.tools.build:gradle:8.0.0.
[capacitor] Required by:
[capacitor] project :
[capacitor] > No matching variant of com.android.tools.build:gradle:8.0.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute ‘org.gradle.plugin.api-version’ with value ‘8.0.2’ but:
[capacitor] - Variant ‘apiElements’ capability com.android.tools.build:gradle:8.0.0 declares a library, packaged as a jar, and its dependencies declared externally:
[capacitor] - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
[capacitor] - Other compatible attribute:
[capacitor] - Doesn’t say anything about org.gradle.plugin.api-version (required ‘8.0.2’)
[capacitor] - Variant ‘javadocElements’ capability com.android.tools.build:gradle:8.0.0 declares a component for use during runtime, and its dependencies declared externally:
[capacitor] - Incompatible because this component declares documentation and the consumer needed a library

Any cluees ?
Thks In Advance

Capacitor 5 requires java 17, looks like it’s trying to use java 8.

What do you get if you run java -version?

If you don’t get java 17, then install java 17 and set your JAVA_HOME variable to use that new version.

1 Like

Yes! I have Java 8 so let me install 17 for testing

Install Java 17 I dont get the error before but now when I executte command for livereload the server goes fine but when I do any changes in my code the page goes to blank and I get this

Page not found
http://10.0.0.17:8100/

net::ERR_TIMED_OUT

but it connects by USB not network

Thks In Advance

:space_invader: Using capacitor with Live Reload :space_invader:
:arrow_right: *1° Go to ‘package .json’ and add the following line in the Scripts

"startServer": "ng serve --port 8100 --host 0.0.0.0 --disable-host-check",

:gear: It will be necessary that the project is already running with this command above to continue the steps below! :gear:

:arrow_right: 2° Find your local IP!

On windows use ‘ipconfig’ to know your IP…
On Linux use 'ifconfig.

:arrow_right: 3° After knowing your IP, edit the file ‘capacitor.config.json’

Create a server if it doesn’t exist!
Replace ‘0.0.0.0’ with your IP and set the port your project is running on!

“server”: { “url”: “http://0.0.0.0:8100”, “cleartext”: true },

:arrow_right: *4° Run the build commands on your device, wait for Android Studio to finish the installation. Have fun using live reload!

You can close Android Studio as it is no longer needed!
To debug use the VSCode or your Browser

I was struggling for few days without success and you eased my pressure with this answer, THANK YOU!