I am new in Android Studio. After setup, When I am trying to import an application I am getting that error So that gradle not able to build.
Error:> Could not initialize class com.android.repository.api.RepoManager
I checked that my classpath setting for Java is fine. I am running Windows OS. Does anyone know the source of the error?
2
Answers
A downgrade to
Android Studio 4.0
fixed the error for me.I had this issue while trying to run a 5-year-old android project. Following these steps fixed the issue for me:
1- update gradle version in the project level build.gradle file from
classpath 'com.android.tools.build:gradle:2.2.2'
to
classpath 'com.android.tools.build:gradle:7.1.1'
2- add google() to the project repositories
and in buildScript block as well:
3- update gradle version in gradle-wrapper.properties file to an up-to-date version, I updated to 7.2
4- In the app level build.gradle file, in the dependencies block, I changed
compile
toimplementation
5- sync the project