android - Gradle 永远下载 "builder-3.1.2.jar"

标签 android android-studio android-gradle-plugin

你好,我真的需要你的帮助。

我正在使用 Android Studio 3.1.2,我是 Android 应用开发的新手。

因此,我在使用 Gradle 时遇到了一些问题。当我创建一个新项目时,Gradle 构建开始,但下载需要 FOREVER。我已经等了 3 个小时才完成下载。

当我在浏览器中复制/粘贴下载文件 ( https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.1.2/builder-3.1.2.jar ) 时,只用了 30 秒。我尝试了一切并搜索了所有 stackoverflow,但我一无所获 :(

谢谢

更新 这是我要求的两个文件。

我的项目build.gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.bg.selim.reminder"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

我的 gradle.properties 文件:

# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

项目根目录下的build.gradle文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

最佳答案

如果还是有问题,可以尝试下载builder-3.1.2.jar及其 builder-3.1.2.pom文件,并将它们放入您的 Android Studio 文件夹中:

AndroidStudio > gradle > m2repository > com > android > tools > build > builder > 3.1.2 

builder-3.1.2.jarbuilder-3.1.2.pom 放在文件夹 3.1.2 下就可以了。

关于android - Gradle 永远下载 "builder-3.1.2.jar",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50089292/

相关文章:

android - 设置ImageResource时ImageView变慢

android - 如何创建 Cloud Function 并在 Cloud Firestore 中触发它

calendar - 当我的日历有繁忙事件时,如何以编程方式将来电重定向到语音邮件

java - 使用白色图像隐藏 Android Studio 中的所有 textView

android - 如何在不公开源代码的情况下使用 gradle 创建 Android Library Jar?

android - Kotlin 多平台 : How to mock objects in a unit test for iOS

Android ImageView.setImageURI 缩放图片

java - 在 Mac OSX 上将 JDK 7 或更高版本与 Android Studio 和 Eclipse 结合使用

Android build.gradle 文件的 adbOptions 方法是做什么用的?

android - android中的gradle依赖错误