Ionic livereload on Android fails with "cannot find tools.jar"

Hi,

I am trying to enable live reload on my android device.
Android studio is working.

But when I try ionic cap run android -l --external, this issue was produced.

I have added JAVA_HOME to my system variable and add %JAVA_HOME%\bin to the PATH.
I also tried to explicitly define the path in gradle.properties
But none of them works.

Could you suggest what can I do to fix this problem
Thanks

(base) PS D:\work\personal\cheese> ionic cap run android -l --external
? Which device would you like to target? Xiaomi MI 6 (9abf2c96)
> capacitor.cmd sync android
[capacitor] √ Copying web assets from dist to android\app\src\main\assets\public in 238.98ms
[capacitor] √ Creating capacitor.config.json in android\app\src\main\assets in 1.75ms
[capacitor] √ copy android in 282.69ms
[capacitor] √ Updating Android plugins in 8.97ms
[capacitor] [info] Found 6 Capacitor plugins for android: 
[capacitor]        @capacitor-community/bluetooth-le@1.1.2
[capacitor]        @capacitor/app@1.0.2
[capacitor]        @capacitor/camera@1.0.3
[capacitor]        @capacitor/haptics@1.0.2
[capacitor]        @capacitor/keyboard@1.0.2
[capacitor]        @capacitor/status-bar@1.0.2
[capacitor] √ update android in 132.79ms
[capacitor] [info] Sync finished in 0.42s
> vue-cli-service.cmd serve
[vue-cli-service]  INFO  Starting development server...

[INFO] Development server running!

       Local: http://localhost:8100
       External: http://192.168.1.89:8100

       Use Ctrl+C to quit this process

[vue-cli-service]   App running at:
[vue-cli-service]   - Local:   http://localhost:8100/
[vue-cli-service]   - Network: http://192.168.1.89:8100/
[vue-cli-service]   Note that the development build is not optimized.
[vue-cli-service]   To create a production build, run npm run build.
[vue-cli-service] Issues checking in progress...
> capacitor.cmd run android --no-sync --target 9abf2c96
[vue-cli-service] No issues found.
[capacitor] × Running Gradle build - failed!
[capacitor] [error] 
[capacitor]         > Configure project :app
[capacitor]         google-services.json not found, google-services plugin not applied. Push Notifications won't work
[capacitor]         WARNING:: Using flatDir should be avoided because it doesn't support any meta-data formats.
[capacitor]
[capacitor]         > Configure project :capacitor-cordova-android-plugins
[capacitor]         WARNING:: Using flatDir should be avoided because it doesn't support any meta-data formats.
[capacitor]
[capacitor]         > Task :app:preBuild UP-TO-DATE
[capacitor]         > Task :app:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-android:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-android:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-android:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-app:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-app:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-app:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-camera:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-camera:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-camera:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-community-bluetooth-le:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-cordova-android-plugins:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-haptics:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-keyboard:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-status-bar:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:compileDebugAidl NO-SOURCE
[capacitor]         > Task :app:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-android:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-app:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-camera:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-community-bluetooth-le:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-cordova-android-plugins:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-haptics:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-keyboard:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-status-bar:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :app:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :app:generateDebugBuildConfig UP-TO-DATE
[capacitor]         > Task :app:javaPreCompileDebug UP-TO-DATE
[capacitor]         > Task :capacitor-android:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-app:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-camera:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:writeDebugAarMetadata
[capacitor]         > Task :capacitor-status-bar:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :app:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :app:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-android:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-android:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-android:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-android:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-app:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-app:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-app:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-app:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-camera:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-camera:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-camera:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-camera:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-community-bluetooth-le:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-cordova-android-plugins:generateDebugResValues
[capacitor]         > Task :capacitor-cordova-android-plugins:generateDebugResources
[capacitor]         > Task :capacitor-cordova-android-plugins:packageDebugResources
[capacitor]         > Task :capacitor-haptics:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-haptics:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-keyboard:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :app:checkDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-status-bar:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:packageDebugResources UP-TO-DATE
[capacitor]         > Task :app:mergeDebugResources UP-TO-DATE
[capacitor]         > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[capacitor]         > Task :app:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-android:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-android:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-app:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-app:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-camera:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-camera:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:extractDeepLinksDebug
[capacitor]         > Task :capacitor-haptics:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-android:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-android:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:processDebugManifest
[capacitor]         > Task :capacitor-android:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :app:processDebugMainManifest UP-TO-DATE
[capacitor]         > Task :app:processDebugManifest UP-TO-DATE
[capacitor]         > Task :app:processDebugManifestForPackage UP-TO-DATE
[capacitor]         > Task :capacitor-app:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-app:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-app:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-camera:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-camera:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-camera:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-community-bluetooth-le:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:compileDebugLibraryResources
[capacitor]         > Task :capacitor-haptics:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:parseDebugLocalResources
[capacitor]         > Task :capacitor-haptics:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:generateDebugRFile
[capacitor]         > Task :capacitor-keyboard:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :app:processDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-android:generateDebugBuildConfig UP-TO-DATE
[capacitor]         > Task :capacitor-android:javaPreCompileDebug UP-TO-DATE
[capacitor]         > Task :capacitor-android:compileDebugJavaWithJavac FAILED
[capacitor]
[capacitor]         FAILURE: Build failed with an exception.
[capacitor]
[capacitor]         * What went wrong:
[capacitor]         Execution failed for task ':capacitor-android:compileDebugJavaWithJavac'.
[capacitor]         > Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_301 contains a valid JDK installation.
[capacitor]
[capacitor]         * Try:
[capacitor]         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.      
[capacitor]
[capacitor]         * Get more help at https://help.gradle.org
[capacitor]
[capacitor]         Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[capacitor]         Use '--warning-mode all' to show the individual deprecation warnings.
[capacitor]
[capacitor]         BUILD FAILED in 2s
[capacitor]         See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
[capacitor]         78 actionable tasks: 9 executed, 69 up-to-date
[capacitor]
[ERROR] An error occurred while running subprocess capacitor.

I found the issue.
I have only JRE installed on my computer but it requires a JDK.
After installing the JDK, and change the JAVA_HOME to the JDK path, the gradle is happy now.