so before i just changed my device, my ionic project working just fine when i tried to run live reload. i think i have installed all the same version of jdk and node js as my old device.
and now, i've been getting this error when i tried to run ionic cap run android -l --external
[capacitor] × Running Gradle build - failed!
[capacitor] [error]
[capacitor] FAILURE: Build failed with an exception.
[capacitor]
[capacitor] * What went wrong:
[capacitor] Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
[capacitor] > Exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
[in thread "Daemon worker"]
[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 wi
th --scan to get full insights.
[capacitor]
[capacitor] * Get more help at https://help.gradle.org
[capacitor]
[capacitor] BUILD FAILED in 1s
[capacitor]
[ERROR] An error occurred while running subprocess capacitor.
i've been looking for answers, and mostly they told me to change this line of code
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
but it just gave me another error. i tried to change it to some other versions. but still, it didnt work.
I expected my ionic app will be able to run livereload.
I resolved this problem by adding this line in my gradle.properties
org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED