cordova 12 编译失败 No matching variant of com.android.tools.build:gradle:7.4.2 was found

cordova 12 编译失败

问题描述:

  > 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

cordova 12 编译失败 No matching variant of com.android.tools.build:gradle:7.4.2 was found_第1张图片

解决办法:

把你的JDK版本切换到11,jdk11 bin 添加到环境变量添加到环境变量

下载jdk11配置到环境变量的一种方法
cordova 12 编译失败 No matching variant of com.android.tools.build:gradle:7.4.2 was found_第2张图片

你可能感兴趣的:(Cordova,android)