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.
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:
- Installed older SDK build tools 19.1.0 to use previous Gradle versions
- File> Project Structure > Project > And change the gradle version to 2.3.0
- 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
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.
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.
Just press in AndroidStudio:
Sync Project with Gradle Files.
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*****
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
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....
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.
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
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.
Download it manually from https://gradle.org/releases/ .
Extract it and make a dir for it in ur Android Studio And your SYSTEM.
Android Studio: Setting > Build > Gradle > Uncheck Offline Work and put the DIR.
System: Environment Variables > Edit(if u have another gradle PATH) or New > put The DIR.
Have a good day.
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.
来源:https://stackoverflow.com/questions/42593758/gradle-error-after-updating-to-android-studio-2-3