2
votes

When an android app which uses com.android.tools.build:gradle:7.0.0-alpha06 tools is build using the command line (gradle build) with gradle 6.8.1 or 6.8.2, fails by saying

*FAILURE: Build failed with an exception.

  • What went wrong: lateinit property variantName has not been initialized
  • 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*

Is there any workaround for this

2

2 Answers

1
votes

Update the gradle plugin in the app-level build.gradle file to "7.0.0-alpha07", and it should be solved.

classpath "com.android.tools.build:gradle:7.0.0-alpha07"
2
votes

It seems in your code there is a variable named "variantName" that has not been initialized yet. Please share your code if you still face any issue.