Aditya Desai
Aditya Desai

Reputation: 425

Gradle error after updating to Android Studio 2.3

The gradle build is failing with the message

 Error:Could not create parent directory for lock file C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\wrapper\dists\gradle-2.14.1-all\8bnwg5hd3w55iofp58khbp6yv\gradle-2.14.1-all.zip.lck

This is my build.gradle(Project)

 // Top-level build file where you can add configuration options common to all sub-projects/modules.

 buildscript {
   repositories {
    jcenter()
}
    dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
 }

allprojects {
  repositories {
    jcenter()
  }
}

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

All projects show the same error after the update.

Upvotes: 10

Views: 49847

Answers (12)

Ziad
Ziad

Reputation: 1

  1. Download it manually from https://gradle.org/releases/ .

  2. Extract it and make a dir for it in ur Android Studio And your SYSTEM.

  3. Android Studio: Setting > Build > Gradle > Uncheck Offline Work and put the DIR.

  4. System: Environment Variables > Edit(if u have another gradle PATH) or New > put The DIR.

Have a good day.

Upvotes: 0

Johan
Johan

Reputation: 1

Try my solution

I'm using android studio 2.3.1, i just make a few step to solved the problem.

based on doc at androiddev https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle

Plugin version Required Gradle version

  • 1.0.0 - 1.1.3 2.2.1 - 2.3
  • 1.2.0 - 1.3.1 2.2.1 - 2.9
  • 1.5.0 2.2.1 - 2.13
  • 2.0.0 - 2.1.2 2.10 - 2.13
  • 2.1.3 - 2.2.3 2.14.1+
  • 2.3.0+ 3.3+

Requirement : Gradle version 3.4

Step 1 Remove all gradle in folder C:\Users\.gradle\daemon

Step 2 Redownload Gradle 3.4 and put in directories C:\programfiles\android\androidstudio\gradle

step 3 Configure gradle in android studio 2.3.1 gradle settings. change to folder "C:\Program Files\Android\Android Studio\gradle\gradle-3.4"

Step 4 close your android studio and reopen project

I hope this solution help.

Upvotes: 0

Tse Des
Tse Des

Reputation: 1

i had the same problem. this is how i solved mine:
1. Download gradle-4.0
2.Download NDK using SDK manager
3. open file>settings>Build,Execution,Deployment>gradle and configured as below. Click Here to view image

it solved my problem

Upvotes: 0

Vikashini
Vikashini

Reputation: 1

Just try to change this line like the below one distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip

and refresh it. If it still not works then there can be option which will automatically update your dependencies according to the version installed.

Upvotes: -1

Mark Piller
Mark Piller

Reputation: 1

I had the exact same problem. I debugged the issue by adding debug statements to \platforms\android\cordova\lib\check_reqs.js (90:25). From this debug I found that my previous SDK did have a templates directory - for my installation is is: C:\Android\SDK\tools\templates.

Fortunately I had a backup of that directory. So my final solution for Android 2.3.1 installation was to copy my C:\Android\SDK\tools\templates directory to the newly created SDK directory from the 2.3.1 installation.

I don't like this in-eligant solution but it did immediately resolve my problem.

I hope this helps someone.

Upvotes: 0

Sonic Splasher
Sonic Splasher

Reputation: 111

Android studio 2.3 and preview 2.4 requires Gradle version 3.3 & above!!! I had 2.8 it didn't work.
I installed 3.4 & it still didn't work, I figured out that the source directory
was set to 2.8, not 3.4!!
So make sure u have 3.3 or 3.4 installed and the path is set to the correct one... Even don't set the path to say
C:\user......\gardle\bin
set it to
C:\user.....\gradle
I had the problem for days!!!Wish it works well for you....

Upvotes: 0

ModWilliam
ModWilliam

Reputation: 55

I tried some of the other suggestions here, but ultimately after deleting my .gradle directory and setting everything up again it seemed to be OK

Upvotes: 0

Shankar
Shankar

Reputation: 636

I was also facing the similar error, below changes did the job.

The issue was Android Studio 2,3 and it's default gradle version is 3.3.

I accidentally updated SDK build tools to latest one 25.0 .0, after Android Studio popped up message to update and Gradle plugin version to 2.3.0 for which required gradle version is 3.3+.

I did the below changes to fix the issue:

  1. Installed older SDK build tools 19.1.0 to use previous Gradle versions
  2. File> Project Structure > Project > And change the gradle version to 2.3.0
  3. Changed build.gradle(Project: app_name) > classpath 'com.android.tools.build:gradle:3.3.0' to 'com.android.tools.build:gradle:2.1.2'

Finally, do Invalidate Caches / Restart or Sync.

It seems like it's better not to use 3.3 yet. Source & Credits

Upvotes: 6

Morozov
Morozov

Reputation: 5250

Just press in AndroidStudio:

Sync Project with Gradle Files.

Upvotes: 1

Manmohan Pal
Manmohan Pal

Reputation: 1577

Step 1:changes in gradle-wrapper.proprties

distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

Step 2:changes in app\build.gradle

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

Step 3: changes in project level build.gradle

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

sync your project.
It solved my problem.

Upvotes: 3

user5629272
user5629272

Reputation:

Hi i am also got the same problem. But now i got solution

First you should update Android NDK-bundle. This is under File--> Project Structure SDK Location last one. There is one option download.

After Again create new package with all plugins install again Then import the project. That time don't do update again. Then it was working me.

Try it All the best*****

Upvotes: 0

bitvale
bitvale

Reputation: 2079

Try to set in your build.gradle:

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

In gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

And then check "Use default gradle wrapper (recommended)" in Android Studio settings (Gradle tab).

Sync project or invalidate cash and restart.

Upvotes: 3

Related Questions