Natasha Murashkina
05/30/2023, 2:20 PM...
Welcome to Gradle 7.5.1!
...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'MyApplication'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:7.4.2.
Required by:
project : > com.android.application:com.android.application.gradle.plugin:7.4.2
project : > com.android.library:com.android.library.gradle.plugin:7.4.2
> No matching variant of com.android.tools.build:gradle:7.4.2 was found. ...
(Full compilation output)
I didn't change anything in the template and am using fresh macOS (Ventura 13.3.1) and Android Studio (Flamingo 2022.2.1) versions.
In gradle.properties agp.version
is 7.4.2
Any idea why Gradle 7.5.1 was used?
Alternatively, I'd appreciate any pointers to working tutorials.Konstantin Tskhovrebov
05/30/2023, 2:45 PM./gradlew ...
?Konstantin Tskhovrebov
05/30/2023, 2:46 PMgradle ...
, it means that you use the system gradleNatasha Murashkina
05/30/2023, 2:46 PMNatasha Murashkina
05/30/2023, 2:48 PMhfhbd
05/30/2023, 2:58 PMhfhbd
05/30/2023, 3:00 PM- Variant 'apiElements' capability com.android.tools.build:gradle:7.4.2 declares a library, packaged as a jar, and its dependencies declared externally:
- 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 Java 8
Depending how you called the build, you might have Java 8 as defaultNatasha Murashkina
05/30/2023, 3:00 PMhfhbd
05/30/2023, 3:04 PMNatasha Murashkina
05/30/2023, 3:11 PMbuild.gradle.kts
file, and it's already Java 11 in the template project source codeNatasha Murashkina
05/30/2023, 3:11 PMhfhbd
05/30/2023, 3:50 PMJAVA_HOME=path to your java 11 home
should be enough.Joel Denke
05/30/2023, 8:47 PMCong Tuan Hoang
05/31/2023, 4:02 AMNatasha Murashkina
05/31/2023, 9:45 AMJoel Denke
05/31/2023, 9:57 AMbrew install java17
and get automatic recommendation of symlinks if needed.
Usually I think using systems Java better, as can use across other things than ANdroid Studio. Or using java toolchain from Gradle, let it on the fly install it for you.
Maybe over kill not sure, but some ideas if want to try later on 🙂
Nice it solved for you! 🙂Natasha Murashkina
05/31/2023, 9:59 AMNatasha Murashkina
05/16/2024, 12:56 PMThe operation couldn't be completed. Unable to locate a Java Runtime.
Note: I had the same issue 12 months ago, from my first attempt at doing the same on my old Air 2018. It resolved when I chose Android Studio's embedded Java. However, I checked, and I do use it now (see screenshot inside).
Any ideas about which Java I should be using and how to set it up?
I remember the last time the issue was something like Cococapods used different javas for Android and iOS, but I didn't understand the issue thoroughly enough.Natasha Murashkina
05/16/2024, 12:58 PMNatasha Murashkina
05/16/2024, 1:10 PM