现在我们正处于构建时间为2分30秒的情况下进行非常简单的更改.这(与ANT相比)速度惊人,并且正在削弱整个团队的生产力.我正在使用Android Studio并使用"使用本地gradle分发".我试图给予更多的记忆力:
org.gradle.jvmargs = -Xmx6096m -XX:MaxPermSize = 2048m -XX:+ HeapDumpOnOutOfMemoryError -Dfile.encoding = UTF-8
更多的记忆.并且它仍然不时给记忆带来错误.
线程"pool-1-thread-1"中的异常java.lang.OutOfMemoryError:超出GC开销限制
惊人.我正在使用并行选项和守护进程:
org.gradle.parallel =真
org.gradle.daemon =真
它并没有真正帮助.
我把上述参数放在〜/ .gradle/gradle.properties中(我甚至怀疑Android工作室是否忽略了这一点,所以我测试了 - 它并没有忽略它).
仍然从终端我在Android Studio中获得1:30构建时间与2:30,所以不确定那里有什么问题.与Ant相比,1:30仍然是疯狂的.如果您知道Android Studio正在做什么(或忽略或重写为gradle配置),我将不胜感激.
所以只需要CMD + B(简单编译)就可以在变化后超快,比如7秒.但是当涉及到运行应用程序时,它会启动任务dexXxxDebug,这只是在杀死我们.我试过试试
Run Code Online (Sandbox Code Playgroud)dexOptions { preDexLibraries = false }
没有帮助.
我知道gradle可能还没有为生产环境做好准备,但我开始后悔我们决定尽早采取行动.我们有很多模块,这可能是问题的一部分,但这不是Ant的问题.
任何帮助表示赞赏,Dan
有关执行时间的更多信息:
描述持续时间
Total Build Time 1m36.57s
Startup 0.544s
Settings and BuildSrc 0.026s
Loading Projects 0.027s
Configuring Projects 0.889s
Task Execution 1m36.70s
Run Code Online (Sandbox Code Playgroud)
时间吃的人:app:dexDebug 1m16.46s
我正在尝试将Google Plus集成到我的应用程序中,并显示以下错误.以下是例外和gradle
错误:任务':app:transformClassesWithDexForDebug'的执行失败.
com.android.build.transform.api.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\ Program Files\Java\jdk1.7.0_79\bin\java.exe''以非零退出值1结束
app build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "xxx.com.xxxx"
multiDexEnabled true
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
//depend-materialcalendar
compile 'com.prolificinteractive:material-calendarview:0.8.1'
compile 'com.android.support:gridlayout-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.melnykov:floatingactionbutton:1.3.0'
//depend-cometchat
compile 'com.yalantis:contextmenu:1.0.4'
compile 'com.google.code.gson:gson:2.3'
compile files('libs/appcompat_v7.jar')
compile files('libs/cometchat-sdk.jar')
compile files('libs/jsoup-1.7.3.jar')
compile files('libs/picasso-2.5.2.jar')
compile 'com.google.android.gms:play-services:8.1.0' …Run Code Online (Sandbox Code Playgroud) android google-plus google-play-services android-studio build.gradle
当我在Xerces库中导入时,我似乎无法构建我的应用程序.由于之前的问题,我已经在使用multidex,因此我知道这一切都已正确设置.
我花了几天时间在线查看并尝试各种版本的Xerces并调整到我的build.gradle但无法解决问题.我已经尝试过清理重建,重新设置Android Studio /我的PC,使用jar直接编译,现在正式出于想法.
下面是我的build.gradle设置:
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "#packageid#"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "0.8"
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'me.dm7.barcodescanner:zbar:1.8.4'
compile project(':rangebar-1.3')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile 'com.batch.android:batch-sdk:1.5'
compile 'xerces:xercesImpl:2.11.0' …Run Code Online (Sandbox Code Playgroud)