AndroidStudio 报错:Could not find com.android.tools.build:gradle
程序员文章站
2022-05-09 20:38:09
【AndroidStudio 报错:Could not find com.android.tools.build:gradle】
报错
Error: Could not f...
【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目录下
上一篇: 老师的经典爆笑
推荐阅读
-
AndroidStudio报错:Could not download gradle.jar:No cacahed version available for offline mode
-
AndroidStudio报错:GradleSyncIssues-Could not install Gradle distribution from...
-
swagger 集成后发布到服务器报错[Could not find file 'D:\\home\\site\\wwwroot\\bin\\WebAPI.XML]
-
AndroidStudio 报错:Could not find com.android.tools.build:gradle
-
【js】react-native Could not find iPhone 6 simulator 和 Entry, ":CFBundleIdentifier", Does Not Exist 两种报错解决办法
-
Flutter Could not resolve com.android.tools.build:gradle:xx.xx.xx
-
MyBatis报错笔记——Could not find parameter map XXX.XXX.xml
-
Could not find artifact org.springframework.cloud:spring-cloud-netflix-eureka-server报错
-
淘淘商城第60讲——搭建Solr集群时,报错:org.apache.solr.common.SolrException: Could not find collection : core1
-
flutter项目报错:Could not find method flutter() for arguments