Taslim Oseni
Taslim Oseni

Reputation: 6273

Gradle: Could not resolve all dependencies for configuration ':classpath'

I've been facing a problem with my android studio. Anytime I try to run an application, any application (even blank one), an error would occur. It's always in this form:

NB: Flip is the name of the application...

Error: Gradle: A problem occurred configuring root project 'Flip'. 
     - Could not resolve all dependencies for configuration ':classpath'. 
     - Could not resolve com.android.tools.build:gradle:1.1.0.
        Required by:
                   :Flip:unspecified

I've searched for solutions for days to no avail and it has rendered my android studio almost useless.

Upvotes: 4

Views: 26674

Answers (3)

Mahdieh Shavandi
Mahdieh Shavandi

Reputation: 8645

My error was:

Could not resolve all dependencies for configuration ':classpath'. > Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository()

There was a lock file in m project android/.gradle/buildOutputCleanup.lock which I needed to remove before continuing to run the project (I'm using react-native)

But actually, it wasn't removed, it kept saying this file is open in Java SE

So, first I had to run (I'm using windows):

tasklist | findstr java

So, all the running Java instances will be displayed with their PID. Then kill each process by its PID:

taskkill /F /PID  <PID>  // It will be like taskkill /Fn /PID 23172

Then I was able to remove that lock file and I could rebuild the project

Upvotes: 1

user11224911
user11224911

Reputation:

Go to your build.gradle (project), hover around the classpath and update the version to the suggested update.

If the suggestion above does not work, it means there is a sync problem. Simply do this:

File > Invalidate cache and restart

If everything else is set up correctly, it's definitely bound to work after that.

Upvotes: 0

Ahmad Aghazadeh
Ahmad Aghazadeh

Reputation: 17131

Update last version android studio to 2.1.2 and change

classpath 'com.android.tools.build:gradle:2.1.2'

Upvotes: 3

Related Questions