我在build.gradle文件中将compileSdkVersion,targetSdkVersion和依赖项从26更改为27并单击了同步按钮。
这是我的问题。 gradle构建运行永远不会结束。我已经等了好几个小时了。
当我运行项目时也会出现此问题。
问题的原因是什么?
build.gradle(模块:应用)
tooltips: { to: function().... }
的build.gradle(项目)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.gywjd.comprehensivedesign"
minSdkVersion 21
targetSdkVersion 27
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
crunchPngs false
ext.enableCrashlytics = false
ext.alwaysUpdateBuildId = false
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
release {
minifyEnabled true
crunchPngs false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode true
maxProcessCount 4 // this is the default value
javaMaxHeapSize "4g"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
VMoptions
// 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.0.1'
// 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
}
gradle.properties
# custom Android Studio VM options, see
https://developer.android.com/studio/intro/studio-config.html
-Xms3g
-Xmx7g
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseCompressedOops