question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cordova-android 9.0 problem - Could not initialize class com.android.build.gradle.internal.VariantManager

See original GitHub issue

Issue 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:closed
  • Created 3 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
fjellandermediacommented, Oct 28, 2020

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.

1reaction
breautekcommented, Oct 28, 2020

I tried it. After a reinstallation of cordova-android it doesn’t show the first error anymore. It does however still show the

com.android.build.gradle.internal.VariantManager

error i mentioned in my first post.

Thank you very much for investigating this with me. I very much appriciate it!

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

[GitHub] [cordova-android] fjellandermedia opened a new ...
... fjellandermedia opened a new issue #1078: cordova-android 9.0 problem - Could not initialize class com.android.build.gradle.internal.VariantManager.
Read more >
Could not initialize class com.android.build.gradle.AppPlugin ...
In general, to solve this problem, go to File> Build, Execution, Deployment> Gradle> Android Studio in android studio there tick enable ...
Read more >
Could not initialize class com.android.build.gradle.internal ...
Hey Team, I am trying to Setup the react-native in my local system. Following the documentation to setup. I am just following official ......
Read more >
[GitHub] [cordova-android] fjellandermedia edited a comment on ...
[GitHub] [cordova-android] fjellandermedia edited a comment on issue #1078: ... 9.0 problem - Could not initialize class com.android.build.gradle.internal.
Read more >
How to fix "Could not initialize class com.android ... - YouTube
Simple fix is given for " Could not initialize class com. android.sdklib.repository.AndroidSdkHandler" in android studio #AndroidSdkHandler ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found