我最近将Android Studio
升级到2.2.3版,但从那时起,构建时间已超过5分钟,这非常令人沮丧。我浏览了类似的帖子并尝试更改配置,但似乎没有任何效果。
的build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
defaultConfig {
applicationId "in.xx.yy"
minSdkVersion 17
targetSdkVersion 24
versionCode 2001
versionName "Stable Release 20"
multiDexEnabled = true
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "XYZ",
onesignal_google_project_number: "XYZ"]
}
signingConfigs {
debug {
storeFile file("C:\\keys\\app.jks")
storePassword "XYZ"
keyAlias "XYZrelease"
keyPassword "XYZ"
}
}
buildTypes {
release {
signingConfig signingConfigs.debug
minifyEnabled true
shrinkResources true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.debug
debuggable true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
// incremental true
preDexLibraries false
javaMaxHeapSize "4g"
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://jitpack.io' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.prolificinteractive:material-calendarview:1.2.0'
compile 'com.onesignal:OneSignal:3.+@aar'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'commons-validator:commons-validator:1.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1@aar'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.heinrichreimersoftware:material-intro:1.5.5'
}
apply plugin: 'com.google.gms.google-services'
gradle.properties
systemProp.http.proxyHost=192.168.1.200
org.gradle.jvmargs=-Xms1024m -Xmx4608m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true
systemProp.http.proxyPort=3128
android.enableBuildCache=true
我是Android新手;我正在使用带有8GB RAM的Windows 10 PC。任何帮助将不胜感激。
答案 0 :(得分:1)
请查看docs,尤其是关于" studio.vmoptions"的部分。使用此文件,您可以了解可以使用多少RAM来运行AS。 请记住设置/使用正确的(桌面)-shortcuts ...默认情况下会创建一个32位配置快捷方式,我猜(现在不能检查它)。