Hello Guys, How are you all? Hope You all Are Fine. Today I just updated Android Gradle Plugin to the latest version of 7.1.0, But After Update I am facing following error: Unable to load class ‘com.android.build.api.extension.AndroidComponentsExtension’ This is an unexpected error in Android. So Here I am Explain to you all the possible solutions here.
Without wasting your time, Let’s start This Article to Solve This Error.
How This Error Occurs ?
I just updated Android Gradle Plugin to the latest version of 7.1.0, But After Update I am facing following error.
Unable to load class ‘com.android.build.api.extension.AndroidComponentsExtension’.
This is an unexpected error. Please file a bug containing the idea.log file.
How To Solve Unable to load class ‘com.android.build.api.extension.AndroidComponentsExtension’ This is an unexpected error Error ?
- How To Solve Unable to load class ‘com.android.build.api.extension.AndroidComponentsExtension’ This is an unexpected error Error ?
To Solve Unable to load class ‘com.android.build.api.extension.AndroidComponentsExtension’ This is an unexpected error Error Here As per Android Gradle Plugin 7.1.0 release notes AGP APIs that the Navigation Safe Args Gradle plugin depend on have been removed. AGP 7.1 does not work with Navigation Safe Args versions 2.4.0-rc1 or 2.4.0, but will work with versions 2.5.0-alpha01 and 2.4.1 Navigation Safe Args version 2.4.1 not Released yet So that we have to use Safe Args 2.5.0-alpha01 to fix this incompatibility. Just Add this line in your dependencies. Now, Your error must be solved. Thank You.
- Unable to load class ‘com.android.build.api.extension.AndroidComponentsExtension’ This is an unexpected error
To Solve Unable to load class ‘com.android.build.api.extension.AndroidComponentsExtension’ This is an unexpected error Error Here As per Android Gradle Plugin 7.1.0 release notes AGP APIs that the Navigation Safe Args Gradle plugin depend on have been removed. AGP 7.1 does not work with Navigation Safe Args versions 2.4.0-rc1 or 2.4.0, but will work with versions 2.5.0-alpha01 and 2.4.1 Navigation Safe Args version 2.4.1 not Released yet So that we have to use Safe Args 2.5.0-alpha01 to fix this incompatibility. Just Add this line in your dependencies. Now, Your error must be solved. Thank You.
Solution 1: Update Navigation Safe Args versions
Here As per Android Gradle Plugin 7.1.0 release notes
AGP APIs that the Navigation Safe Args Gradle plugin depend on have been removed. AGP 7.1 does not work with Navigation Safe Args versions 2.4.0-rc1 or 2.4.0, but will work with versions 2.5.0-alpha01 and 2.4.1
Navigation Safe Args version 2.4.1 not Released yet So that we have to use Safe Args 2.5.0-alpha01 to fix this incompatibility. Just Add this line in your dependencies.
dependencies {
.
.
.
// Just Update this line and use 2.5.0-alpha01
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.0-alpha01"
.
.
.
}
Now, Your error must be solved. Thank You.
Summary
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read
- MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled