# Ionic Capacitor Run error

**URL:** <https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326>\
**Category:** Ionic Framework\
**Created:** [February 24, 2023, 8:42am UTC](https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326 "2023-02-24T08:42:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flaterik](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/flaterik/32/143812_2.png) [@Flaterik](https://forum.ionicframework.com/u/Flaterik)\
**Post date:** [February 24, 2023, 8:42am UTC](https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326/1 "2023-02-24T08:42:37Z")

</div>

Hi, i have a IONIC CAPACITOR project that build correctly on my JetBrains Rider ide. When i launch the command  
IONIC CAPACITOR COPY and then i open Android Studio and run the project, it run fine.  
But when, from Rider, i launch IONIC CAPACITOR ANDROID RUN and select my device i have this error:

```auto
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:7.4.1.
[capacitor] Required by:
[capacitor] project :
[capacitor] > No matching variant of com.android.tools.build:gradle:7.4.1 was found. The consumer was configured to find a runtime of a library compatible with Java 8, pack
aged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
[capacitor] - Variant 'apiElements' capability com.android.tools.build:gradle:7.4.1 declares a library, packaged as a jar, and its dependencies declared externally:
[capacitor] - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Ja
va 8
[capacitor] - Other compatible attribute:
[capacitor] - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
[capacitor] - Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.1 declares a runtime of a component, and its dependencies declared externally:
[capacitor] - Incompatible because this component declares documentation and the consumer needed a library
[capacitor] - Other compatible attributes:
[capacitor] - Doesn't say anything about its target Java version (required compatibility with Java 8)
[capacitor] - Doesn't say anything about its elements (required them packaged as a jar)
[capacitor] - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
[capacitor] - Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.1 declares a runtime of a library, packaged as a jar, and its dependencies declared ex
ternally:
[capacitor] - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
[capacitor] - Other compatible attribute:
[capacitor] - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
[capacitor] - Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.1 declares a runtime of a component, and its dependencies declared externally:
[capacitor] - Incompatible because this component declares documentation and the consumer needed a library
[capacitor] - Other compatible attributes:
[capacitor] - Doesn't say anything about its target Java version (required compatibility with Java 8)
[capacitor] - Doesn't say anything about its elements (required them packaged as a jar)
[capacitor] - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
[capacitor]
[capacitor] * Try:
[capacitor] > Run with --stacktrace option to get the stack trace.
[capacitor] > Run with --info or --debug option to get more log output.
[capacitor] > Run with --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 need to run from Rider to have the capabilities of live debug to see the modified code

---

<div class="post-metadata">

**Author:** ![julio-ionic](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@julio-ionic](https://forum.ionicframework.com/u/julio-ionic)\
**Post date:** [February 24, 2023, 9:59am UTC](https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326/2 "2023-02-24T09:59:45Z")

</div>

looks like it’s trying to use java 8 but gradle 7 requires java 11  
but not sure how you can configure your app to use java 11 in that IDE

---

<div class="post-metadata">

**Author:** ![Flaterik](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/flaterik/32/143812_2.png) [@Flaterik](https://forum.ionicframework.com/u/Flaterik)\
**Post date:** [February 24, 2023, 11:00am UTC](https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326/3 "2023-02-24T11:00:55Z")

</div>

I’m using Java 11 on Android Studio Config like this:

 ![1](https://global.discourse-cdn.com/ionicframework/original/3X/8/2/8271037c938f61d4bc79f63c8a9083e1bbf01560.png)

The strange is that if i launch the project direct inside Android Studio it works

---

<div class="post-metadata">

**Author:** ![julio-ionic](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@julio-ionic](https://forum.ionicframework.com/u/julio-ionic)\
**Post date:** [February 24, 2023, 12:50pm UTC](https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326/4 "2023-02-24T12:50:43Z")

</div>

It’s not strange, Android Studio is configured to use java 11 as you have shown in the screenshot, so it works there, but the other IDE you use is not respecting that configuration and using java 8.

Make sure you have the JAVA\_HOME variable set and pointing to a java 11 installation.

---

<div class="post-metadata">

**Author:** ![Flaterik](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/flaterik/32/143812_2.png) [@Flaterik](https://forum.ionicframework.com/u/Flaterik)\
**Post date:** [February 24, 2023, 1:20pm UTC](https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326/5 "2023-02-24T13:20:55Z")

</div>

![1](https://global.discourse-cdn.com/ionicframework/original/3X/5/4/5415d042008a4b50c4e32049242d9d62bb25f502.png)  
My JAVA\_HOME point at my JRE and this is the latest version available.  
JAVA 11 maybe is about JDK ?  
So i imagine i can’t point my JAVA\_HOME to JDK

---

<div class="post-metadata">

**Author:** ![julio-ionic](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@julio-ionic](https://forum.ionicframework.com/u/julio-ionic)\
**Post date:** [February 24, 2023, 1:27pm UTC](https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326/6 "2023-02-24T13:27:39Z")

</div>

you can point JAVA\_HOME to the JDK

---

<div class="post-metadata">

**Author:** ![Flaterik](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/flaterik/32/143812_2.png) [@Flaterik](https://forum.ionicframework.com/u/Flaterik)\
**Post date:** [February 24, 2023, 1:45pm UTC](https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326/7 "2023-02-24T13:45:16Z")

</div>

EDIT

It works!

Thank you so much!

---

<div class="post-metadata">

**Author:** ![bofcarbon1](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bofcarbon1/32/146859_2.png) [@bofcarbon1](https://forum.ionicframework.com/u/bofcarbon1)\
**Post date:** [March 3, 2024, 10:48pm UTC](https://forum.ionicframework.com/t/ionic-capacitor-run-error/231326/8 "2024-03-03T22:48:06Z")

</div>

I just started ionic for Vue which generates Android via capacitor and it will automatically start Android Studio with an Android app. i just had Android Studio use JDK 18 that I had installed. My Java\_Home uses a different version of Java so by default I was on the wrong version. For me I do Java, Python on the same machine and I end up using so many versions of Java. On projects with clients I often switch Java versions depending the apps on the many tasks which is very annoying but a way of life with things that do Java.
