如果出现
Gradle sync failed: Could not GET 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.4.0/protobuf-java-3.4.0.jar'.
这个问题(首先说明下我的AS的版本是3.5.2(2020-6-2目前最新版本),出现了上述Gradle sync failed的问题,可以在你的Gradle Scrpits文件下的build.gradle文件中的repositories中添加以下三个url:
maven{
url'http://maven.aliyun.com/nexus/content/groups/public/' }
jcenter {
url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven{
url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {
repositories {
google()//下面这三个是自己需要更改的,也就把以前的jecnter给删掉,换成下面这三个maven{
url'http://maven.aliyun.com/nexus/content/groups/public/' }jcenter {
url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }maven{
url 'http://maven.aliyun.com/nexus/content/repositories/central/'}//mavenCentral() // add repository}dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files}
}allprojects {
repositories {
google()//jcenter()//同理,这个也是,把以前的jcenter()注释掉,然后加上这三个maven{
url'http://maven.aliyun.com/nexus/content/groups/public/' }jcenter {
url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }maven{
url 'http://maven.aliyun.com/nexus/content/repositories/central/'}}
}task clean(type: Delete) {
delete rootProject.buildDir
}
以上解决方法来自一个评论,链接如下
https://blog.csdn.net/kane7csdn/article/details/84071008#%E9%97%AE%E9%A2%98%E4%BA%8C%EF%BC%9A
这里再次感谢那个大佬的方法。在这里写下这个方法,是希望可以给后来者一些错误解决的方法。