你好,我真的需要你的帮助。
我正在使用 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.jar
和 builder-3.1.2.pom
放在文件夹 3.1.2 下就可以了。
关于android - Gradle 永远下载 "builder-3.1.2.jar",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50089292/