【发布时间】:2015-02-06 02:29:50
【问题描述】:
我刚刚下载了 Android Studio 1.0RC4,我无法构建任何项目,甚至是新创建的项目。
我得到的错误是:
错误:无法使用 Gradle 分发版“https://services.gradle.org/distributions/gradle-2.2.1-all.zip”运行构建操作。
我能够从浏览器下载 zip,但它在 AS 上不起作用。这是我的 build.gradle 文件:
// 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-rc1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
模块构建文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "simple.com.car10"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Graddle-wrapper.properties
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
我尝试运行 graddle - 从 cmd 构建,但出现此错误:
FAILURE: Build failed with an exception.
* What went wrong:
Build file 'C:\Users\Giovanni\uild' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
总时间:3.093 秒
JDK:1.8.0_05
当我再次点击尝试时,没有任何反应,我已经尝试卸载所有内容并再次安装,但没有成功。
有什么想法吗?谢谢。
【问题讨论】:
-
这是通用的 Gradle 文件。用你的模块名称发布一个。
-
使用 app graddle 编辑
-
你能显示你的 gradle-wrapper.properties 文件吗?
-
文件中没有什么奇怪的。您是否正确设置了 SDK 路径?你用的是什么JDK?
-
用wrapper和jdk版本编辑,SDK设置正确。
标签: android android-studio android-gradle-plugin