cordova-android 9.0 problem - Could not initialize class com.android.build.gradle.internal.VariantManager
See original GitHub issueIssue Type
- [X ] Bug Report
- Feature Request
- Support Question
Description
Build fails, even on new projects. It works with cordova-android@8.1, but not on cordova-android@9.0. This is the output:
Gabriels-MBP:test gabriel$ cordova build android Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=/Users/gabriel/Library/Android/sdk (recommended setting) ANDROID_HOME=/Users/gabriel/Library/Android/sdk (DEPRECATED) Using Android SDK: /Users/gabriel/Library/Android/sdk Subproject Path: CordovaLib Subproject Path: app
FAILURE: Build failed with an exception.
Where: Build file ‘/Users/gabriel/Documents/cordova/test/platforms/android/app/build.gradle’ line: 20
What went wrong: A problem occurred evaluating project ‘:app’. Could not initialize class com.android.build.gradle.internal.VariantManager
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 1s Command failed with exit code 1: /Users/gabriel/Documents/cordova/test/platforms/android/gradlew cdvBuildDebug -b >/Users/gabriel/Documents/cordova/test/platforms/android/build.gradle`
I have updated to latest Cordova CLI and latest SDK:s and build tools in Android Studio.
Command or Code
cordova create test se.fjellandermedia.test testApp cd test cordova platform add android cordova build android
Environment, Platform, Device
Macbook Pro, macOS 10.15.6
Version information
Checklist
- [ X] I searched for already existing GitHub issues about this
- [X ] I updated all Cordova tooling to their most recent version
- [ X] I included all the necessary information above
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (6 by maintainers)
This is now resolved! I think it was the java version. I had (if memory serves) 1.8.0_20, so I realize now it was quite old. I downloaded the latest 1.8 and now I have 1.8.0_271 and this error is no more.
Thank you very much Norman, for your time. I very much appriciate it! I wish there was anything I could do for you.
Well now I’m going to start blaming gradle…
First I want to make sure you’re using a compatible java version though. Can you run
java -version
and give me the output.Also print out the information from the following command:
/Users/gabriel/Documents/cordova/test/platforms/android/gradlew -v