[android][studio] build a project

来源:互联网 发布:php 执行git命令 编辑:程序博客网 时间:2024/05/17 20:47

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
原创粉丝点击