Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio update -Error:Could not run build action using Gradle distribution

I have recently updated android studio to the latest version,but then comes the problem.

Gradle 'MyApplication' project refresh failed. Error:Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-all.zip'.

Found this in StackOverflow

However trying everything nothing works - cannot create new project of import anything at the moment.Please kindly advice.

  apply plugin: 'com.android.application'      android {     compileSdkVersion 21     buildToolsVersion "21.1.2"       defaultConfig {         applicationId "com.sclick.myapplication"         minSdkVersion 14         targetSdkVersion 21         versionCode 1         versionName "1.0"     }     task assemble{}     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     compile 'com.android.support:appcompat-v7:21.0.3' }        **Top Level Gradle.build** 

// 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:1.0.0'              // NOTE: Do not place your application dependencies here; they belong             // in the individual module build.gradle files         }     }       allprojects {         repositories {             jcenter()         }     } 

gradle-wrapper.properties

  #Wed Apr 10 15:27:10 PDT 2013 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 
like image 379
SomCollection Avatar asked Dec 21 '14 12:12

SomCollection


1 Answers

I had same issue. I have tried many things but nothing worked Until I try following:

  1. Close Android Studio
  2. Delete any directory matching gradle-[version]-all within C:\Users\<username>\.gradle\wrapper\dists\. If you encounter a "File in use" error (or similar), terminate any running Java executables.
  3. Open Android Studio as Administrator.
  4. Try to sync project files.
  5. If the above does not work, try restarting your computer and/or delete the project's .gradle directory.
  6. Open the problem project and trigger a Gradle sync.
like image 77
Bhupinder Avatar answered Sep 20 '22 04:09

Bhupinder