[android][studio] build a project

build error:

 1.

Error:A problem occurred configuring root project 
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:1.0.
     Required by:
      > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.0/gradle-1.0.pom'.
         > Connection to https://repo1.maven.org refused

root cause: gradle version is not correct

solution: 

build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:1.0'
change to 

dependencies {
    classpath 'com.android.tools.build:gradle:1.0.1'
2. 
Error:A problem occurred configuring root project 'AlwaysBeautySettings'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:1.0.1.
     Required by:
         :AlwaysBeautySettings:unspecified
      > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.0.1/gradle-1.0.1.pom'.
         > Connection to https://repo1.maven.org refused
root cause: proxy connection timed out
solution:
file->settings->Appearance&Behavior->system settings->http proxy
  switch to Manual proxy configuration
  fulfill correct proxy server
3.
> Failed to apply plugin [id 'android']
   > Gradle version 2.2 is required. Current version is 2.1. If using the gradle wrapper, try editing the distributionUrl in project/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip
root cause: gradle version conflict
solution:
.gradle/wrapper/dists should be same with:
distributionUrl=http\://services.gradle.org/distributions/gradle-2.1-bin.zip change to 
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2-all.zip
 4.
FAILURE: Build failed with an exception.
* Exception is:
org.gradle.execution.TaskSelectionException: Task '' not found in root project .
root cause: gradle version is low
solution:
cd to project path and execute:
./gradlew
./gradlew  build

or download gradle directly:
http://services.gradle.org/distributions/gradle-2.2-all.zip

5.Gradle sync error:
 SDK version/buildTool conflict
solution:
change project/build.gradle
android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

6. create gradle project from eclips, if building fail, please check:
path: project/gradle/wrapper/gradle-wrapper.properties
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2-all.zip
path:project/build.gradle
android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值