Android Studio 更新 - 错误:无法使用 Gradle 分发运行构建操作 [英] Android Studio update -Error:Could not run build action using Gradle distribution
问题描述
我最近将 android studio 更新到最新版本,但问题来了.
I have recently updated android studio to the latest version,but then comes the problem.
Gradle 'MyApplication' 项目刷新失败.错误:无法使用 Gradle 分发版 'https://services 运行构建操作.gradle.org/distributions/gradle-2.2.1-all.zip'.
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'.
在 StackOverflow 中找到这个
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
推荐答案
我遇到了同样的问题.我尝试了很多东西,但没有任何效果,直到我尝试以下操作:
I had same issue. I have tried many things but nothing worked Until I try following:
- 关闭 Android Studio
- 删除
C:\Users\
中与\.gradle\wrapper\dists\ gradle-[version]-all
匹配的任何目录.如果您遇到文件正在使用"错误(或类似错误),请终止所有正在运行的 Java 可执行文件. - 以管理员身份打开 Android Studio.
- 尝试同步项目文件.
- 如果上述方法不起作用,请尝试重新启动计算机和/或删除项目的
.gradle
目录. - 打开有问题的项目并触发 Gradle 同步.
- Close Android Studio
- Delete any directory matching
gradle-[version]-all
withinC:\Users\<username>\.gradle\wrapper\dists\
. If you encounter a "File in use" error (or similar), terminate any running Java executables. - Open Android Studio as Administrator.
- Try to sync project files.
- If the above does not work, try restarting your computer and/or delete the project's
.gradle
directory. - Open the problem project and trigger a Gradle sync.
这篇关于Android Studio 更新 - 错误:无法使用 Gradle 分发运行构建操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!