Home » Android » Android Studio 3.0 Canary 5 – Error:Unable to load class 'org.gradle.api.internal.component.Usage'

Android Studio 3.0 Canary 5 – Error:Unable to load class 'org.gradle.api.internal.component.Usage'

Posted by: admin May 14, 2020 Leave a comment


I have read through all of the existing stack questions relating to this and their solutions did not help me.

  • This problem has been evident since all AS updates above 2.3.
  • Creating a new project is ok and builds
  • I’ve attempted to copy all values from the ‘new project’ but it still persists

The error:

Error:Unable to load class ‘org.gradle.api.internal.component.Usage’.
Possible causes for this unexpected error include:

  • Gradle’s
    dependency cache may be corrupt (this sometimes occurs after a network
    connection timeout.) Re-download dependencies
    and sync project (requires network)
  • The state of a Gradle
    build process (daemon) may be corrupt. Stopping all Gradle daemons may
    solve this problem. Stop Gradle build
    processes (requires restart)
  • Your project may be using a
    third-party plugin which is not compatible with the other plugins in
    the project or the version of Gradle requested by the

In the case of corrupt Gradle processes, you can
also try closing the IDE and then killing all Java processes.


distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME

Project build.gradle

buildscript {
    repositories {
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
        classpath "io.realm:realm-gradle-plugin:0.89.1"

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }

task clean(type: Delete) {
    delete rootProject.buildDir

Settings Gradle

Use default gradle wrapper

Module Settings

Compile Sdk Version: API 26
Build Tools Version: 26.0.0

I believe these are all the latest available.
And I have tried invalidate caches & restart / rebooting the machine

How to&Answers:

I tried all the above suggestions for deleting cache and nothing worked for me. In the end, the problem was the plugin com.novoda:bintray-release:0.4.0. When I upgraded it to 0.5.0, it worked.

I would take a hard look at your gradle plugins!


Delete Gradle cache C:/users/<yourname>/.gradle (delete the whole directory actually). Then upgrade Gradle and try again.

Or if you are using Gradle wrapper go into properties and upgrade the version of the wrapper ./gradle/wrapper/gradle-wrapper.properties

Your question doesn’t specify the versions, then I assume this might be your problem.

Edit: Check if your plugins are still Compatible with your version of Gradle

io.realm:realm-gradle-plugin:0.89.1 seems a bit old there is a version 3.5.0 already

Since Gradle 3.4 Usage was renamed to UsageContext and maybe one of your plugins, or dependencies is not compatible with Gradle 4.1-milestone that you are using by looking at the distribution Url.