gpt4 book ai didi

android - 无法使用其最新版本为 Android 构建 Cordova 项目

转载 作者:行者123 更新时间:2023-11-30 04:59:44 25 4
gpt4 key购买 nike

我正在使用 Cordova 将我现有的 Android 应用程序版本 (API-27) 升级到 API-28。我使用的是最新版本的 Cordova、Gradle 和 Android。

  1. Cordova - 9.0.0 (cordova-lib@9.0.1)
  2. Gradle - 5.6.2
  3. Android - android-28

问题:


A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.crash.PluginCrashReporter

我通过降级/升级来尝试不同版本的 Cordova 和 Gradle,但无法解决此问题。下面给出了额外的信息,

Gradle-Wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

build.gradle

dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}

build.gradle:也试过了

dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
}

下面给出了有关该问题的详细信息。

Checking Java JDK and Android SDK versions
**ANDROID_SDK_ROOT=C:\Program Files\Android\sdk (recommended setting)
ANDROID_HOME=C:\Program Files\Android\sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app**

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\RandD\Mine\Chess\platforms\android\app\build.gradle' l
ine: 23

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.crash.PluginCrash
Reporter

* Try:
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

BUILD FAILED in 3s
D:\RandD\Mine\Chess\platforms\android\gradlew: Command failed with ex
it code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Build file 'D:\RandD\Mine\Chess\platforms\android\app\build.gradle' l
ine: 23

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.crash.PluginCrash
Reporter

* Try:
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

BUILD FAILED in 3s
Picked up _JAVA_OPTIONS: -Xmx512M

如果我在这里遗漏了什么,请突出显示。感谢您的帮助。

最佳答案

根据我的经验(在 Windows 中),编辑 build.gradle 来更改 Gradle 版本 是不够的,而是尝试全局安装不同的版本。本指南对此进行了详细说明:

Upgrading Gradle for Cordova mobile apps in Windows

此外,盲目地将 Cordova 应用程序的所有内容都切换到最新版本并不是最聪明的主意,您应该继续使用所有内容的不太最新版本,除非您确定出于非常具体的原因需要最新版本。

Before jumping directly to latest gradle version, check compatibility with your Cordova environment. For safety reasons, I wont use anything newer than gradle 4.x on Cordova 7.1.0 alongside Visual Studio, otherwise some issues could be introduced.

关于android - 无法使用其最新版本为 Android 构建 Cordova 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58460381/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com