By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report

Problem

Building a freshly created basic HelloWorld project, the build is failing with

No matching variant of com.android.tools.build:gradle:7.4.2 was found

What is expected to happen?

The build to work.

What does actually happen?

The build fails with No matching variant of com.android.tools.build:gradle:7.4.2 was found

Information

Command or Code

#!/bin/bash
npm i [email protected] [email protected]
PATH=$PWD/node_modules/.bin:$PATH; export PATH
cordova -v
cordova create HelloWorld com.hello.world HelloWorld
cd HelloWorld
cordova platform add android
cordova requirements
cordova build android

Environment, Platform, Device

Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
Command failed with ENOENT: avdmanager list target
spawn avdmanager ENOENT
Gradle: installed /usr/local/Cellar/gradle/8.4/bin/gradle
Some of requirements check failed
Checking Java JDK and Android SDK versions
ANDROID_HOME=undefined (recommended setting)
ANDROID_SDK_ROOT=/Users/adf/Library/android/sdk (DEPRECATED)
Using Android SDK: /Users/adf/Library/Android/sdk

Version information

Cordova 12.0.0
Cordova Android 12.0.1
Cordova Lib 12.0.1
macOS Ventura 13.4 (22F66)
Android Studio Artic Fox: 2020.3.1 patch 1

Android SDK details

Build Output / Error Messages

Build Output npm WARN deprecated [email protected]: This module is not used anymore, and has been replaced by @npmcli/package-json npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs npm WARN deprecated [email protected]: this library is no longer supported npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142

added 555 packages, and audited 556 packages in 3s

63 packages are looking for funding
run npm fund for details

4 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
npm audit fix --force

Run npm audit for details.
12.0.0 ([email protected])
Creating a new cordova project.
Using cordova-fetch for cordova-android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.hello.world
Name: HelloWorld
Activity: MainActivity
Android Target SDK: android-33
Android Compile SDK: 33
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
Command failed with ENOENT: avdmanager list target
spawn avdmanager ENOENT
Gradle: installed /usr/local/Cellar/gradle/8.4/bin/gradle
Some of requirements check failed
Checking Java JDK and Android SDK versions
ANDROID_HOME=undefined (recommended setting)
ANDROID_SDK_ROOT=/Users/xxx/Library/android/sdk (DEPRECATED)
Using Android SDK: /Users/xxx/Library/Android/sdk

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 884ms
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'HelloWorld'.
  • Could not resolve all files for configuration ':classpath'.
    Could not resolve com.android.tools.build:gradle:7.4.2.
    Required by:
    project :
    > No matching variant of com.android.tools.build:gradle:7.4.2 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.6' but:
    - 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
    - Other compatible attribute:
    - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
    - Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
    - Incompatible because this component declares documentation and the consumer needed a library
    - Other compatible attributes:
    - Doesn't say anything about its target Java version (required compatibility with Java 8)
    - Doesn't say anything about its elements (required them packaged as a jar)
    - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
    - Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
    - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
    - Other compatible attribute:
    - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
    - Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
    - Incompatible because this component declares documentation and the consumer needed a library
    - Other compatible attributes:
    - Doesn't say anything about its target Java version (required compatibility with Java 8)
    - Doesn't say anything about its elements (required them packaged as a jar)
    - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')

    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.

  • Get more help at https://help.gradle.org
  • Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

    You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

    See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

    BUILD FAILED in 873ms
    Command failed with exit code 1: /Users/xxx/Sites/RMC2/cordova2/HelloWorld/platforms/android/gradlew -b /Users/xxx/Sites/RMC2/cordova2/HelloWorld/platforms/android/build.gradle cdvBuildDebug

    Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
  •