How to fix "build.gradle" problem in a Cordova project?
Asked Answered
H

4

7
$ 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.
Houseboy answered 9/4, 2019 at 20:41 Comment(1)
My OS is windows 10.Houseboy
H
16

I changed

classpath 'com.android.tools.build:gradle:3.3.0'

to

classpath 'com.android.tools.build:gradle:3.0.1'

in /platforms/android/build.gradle file. My problem is solved.

Houseboy answered 20/4, 2019 at 22:29 Comment(1)
Correct answer, this helped me as well when I had faced same issue. Thanks.Orpington
B
4

build.gradle file in replace :

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

after run : ionic cordova build android --prod --release

Borries answered 29/6, 2019 at 17:26 Comment(0)
A
1

In my case this was caused by a wrong value in your config.xml for android-versionCode

This value should be numerical only.

Acidhead answered 12/5, 2020 at 14:25 Comment(0)
C
0

Change your system language to english
This issue comes with Android Studio 3.3
If you're using Single Language OS you can change version by following
File > Project Structure > Project -> Android Plugin Version = 3.2

Coco answered 18/4, 2019 at 11:16 Comment(2)
where are you doing this? Which application?Blastopore
I think he's using Android Studio IDEDerose

© 2022 - 2024 — McMap. All rights reserved.