本文将带你了解Android应用开发AndroidStudio 报错:Could not find com.android.tools.build:gradle,希望本文对大家学Android有所帮助。
<
【AndroidStudio 报错:Could not find com.android.tools.build:gradle】
报错
Error: Could not find com.android.tools.build:gradle:2.2.1. Searched in the following locations: file:/D:/software/android/android-studio-ide-145.3276617-windows/android-studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom file:/D:/software/android/android-studio-ide-145.3276617-windows/android-studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar
解决方法:进入%android-studio安装目录%\gradle\m2repository\com\android\tools\build\gradle
将项目中的build.gradle文件中
dependencies { classpath 'com.android.tools.build:gradle:2.2.1'}
改为
dependencies { classpath 'com.android.tools.build:gradle:2.2.0'}
即可。
注意:gradle的版本指的是仓库中的gradle编译工具版本,不是gradle版本。
再补充一点
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:2.2.0' // NOTE: Do not place your application dependencies here; they belong // in the inpidual module build.gradle files }}allprojects { repositories { jcenter() }} android { compileSdkVersion 23 buildToolsVersion '23.0.3' compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 }}dependencies {}
中
android { buildToolsVersion ‘23.0.3’ }
这个是在sdk的build-tools目录下
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标移动开发之Android频道!