nic*_*ich 6 java openjdk android android-gradle-plugin
当我构建 android 应用程序时,它可能需要 5 分钟到 15 分钟。如何解决内存问题。有没有办法减少内存消耗?如何让构建更快?
我的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.philliphsu:bottomsheetpickers:2.3.3') {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'gridlayout-v7'
}
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:gridlayout-v7:25.3.1'
compile 'com.philliphsu:bottomsheetpickers:2.3.3'
compile 'com.vk:androidsdk:1.6.8'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
}
Run Code Online (Sandbox Code Playgroud)
还有我的gradle.properties
org.gradle.jvmargs=-Xmx1536m
org.gradle.daemon=true
org.gradle.parallel=true
Run Code Online (Sandbox Code Playgroud)
为什么需要这么长时间以及如何加快项目的组装?
每个人都会给出不同的意见,但我最近通过禁用防病毒软件修复了这个问题。禁用防火墙,因为它会中断 Gradle Daemon 的启动,因此 OpenJDK Platform 二进制文件将继续执行,最终系统会发生内存不足崩溃。
更新:确保无线热点已关闭。最重要的是,在构建项目时,热点一定不能打开。
这样做,稍后谢谢我
Starting Gradle Daemon...
Gradle Daemon started in 4 s 291 ms
Starting Gradle Daemon...
Gradle Daemon started in 5 s 664 ms
Starting Gradle Daemon...
Gradle Daemon started in 2 s 210 ms
Starting Gradle Daemon...
Gradle Daemon started in 7 s 258 ms
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10950 次 |
最近记录: |