【问题标题】:How to fix "build.gradle" problem in a Cordova project?如何修复 Cordova 项目中的“build.gradle”问题?
【发布时间】:2019-04-09 20:41:11
【问题描述】:
$ cordova build android --debug
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=E:\andoidSDK (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\projeler\ohsmobile\platforms\android\CordovaLib\build.gradle' line: 41

* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
> Failed to apply plugin [id 'com.github.dcendents.android-maven']
   > Configuration with name 'testImplementation' not found.

* 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 2s
> Configure project :CordovaLib

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.3/userguide/command_line_interface.html#sec:command_line_warnings
C:\projeler\ohsmobile\platforms\android\gradlew: Command failed with exit code 1 Error output:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\projeler\ohsmobile\platforms\android\CordovaLib\build.gradle' line: 41

* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
> Failed to apply plugin [id 'com.github.dcendents.android-maven']
   > Configuration with name 'testImplementation' not found.

* 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 2s
[ERROR] An error occurred while running subprocess cordova.

        cordova build android --debug exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

【问题讨论】:

  • 我的操作系统是 windows 10。

标签: cordova build.gradle ionic4 apache-cordova


【解决方案1】:

我变了

类路径'com.android.tools.build:gradle:3.3.0'

类路径'com.android.tools.build:gradle:3.0.1'

在 /platforms/android/build.gradle 文件中。我的问题解决了。

【讨论】:

  • 正确答案,当我遇到同样的问题时,这对我也有帮助。谢谢。
【解决方案2】:

build.gradle 文件替换:

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

运行后: ionic cordova build android --prod --release

【讨论】:

    【解决方案3】:

    将您的系统语言更改为英语
    Android Studio 3.3 附带此问题
    如果您使用的是单语言操作系统,您可以通过以下方式更改版本
    文件 > 项目结构 > 项目 -> Android 插件版本 = 3.2

    【讨论】:

    • 你在哪里做这个?哪个应用程序?
    • 我认为他正在使用 Android Studio IDE
    【解决方案4】:

    在我的情况下,这是由 android-versionCode

    的 config.xml 中的错误值引起的

    这个值只能是数字。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-24
      • 1970-01-01
      • 1970-01-01
      • 2013-10-25
      • 1970-01-01
      • 2021-06-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多