【发布时间】:2018-10-09 21:16:37
【问题描述】:
你好,我真的需要你的帮助。
我正在使用 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
}
【问题讨论】:
-
你能发布你的项目 build.gradle 文件和你的 gradle.properties 文件吗?
-
是的,只要一分钟!
-
在您的项目根文件夹中应该有另一个 build.gradle 文件。
-
哦,好吧,我刚刚添加了它
-
是好文件吗?
标签: android android-studio android-gradle-plugin