某处似乎有内存泄漏。
在IntelliJ中设置项目并使用Gradle包装器时:
./gradlew assembleDebug --debug
大约5分钟后我得到以下信息:
14:30:15.245 [INFO] [org.gradle.api.Project] processing scala/collection/SeqViewLike$$anon$5.class...
14:30:53.132 [INFO] [org.gradle.api.Project] processing scala/collection/SeqViewLike$$anon$6.class...
14:33:51.027 [ERROR] [org.gradle.api.Project]
14:33:51.028 [ERROR] [org.gradle.api.Project] UNEXPECTED TOP-LEVEL ERROR:
14:33:51.028 [ERROR] [org.gradle.api.Project] java.lang.OutOfMemoryError: Java heap space
14:33:51.028 [ERROR] [org.gradle.api.Project] at java.util.HashMap.<init>(HashMap.java:209)
14:33:51.029 [ERROR] [org.gradle.api.Project] at com.android.dx.ssa.LocalVariableInfo.<init>(LocalVariableInfo.java:66)
14:33:51.029 [ERROR] [org.gradle.api.Project] at com.android.dx.ssa.LocalVariableExtractor.<init>(LocalVariableExtractor.java:72)
14:33:51.029 [ERROR] [org.gradle.api.Project] at com.android.dx.ssa.LocalVariableExtractor.extract(LocalVariableExtractor.java:54)
14:33:51.029 [ERROR] [org.gradle.api.Project] at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:49)
14:33:51.030 [ERROR] [org.gradle.api.Project] at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:98)
14:33:51.030 [ERROR] [org.gradle.api.Project] at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
14:33:51.030 [ERROR] [org.gradle.api.Project] at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:303)
14:33:51.030 [ERROR] [org.gradle.api.Project] at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
14:33:51.031 [ERROR] [org.gradle.api.Project] at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
14:33:51.031 [ERROR] [org.gradle.api.Project] at com.android.dx.command.dexer.Main.processClass(Main.java:682)
14:33:51.031 [ERROR] [org.gradle.api.Project] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
14:33:51.031 [ERROR] [org.gradle.api.Project] at com.android.dx.command.dexer.Main.access$600(Main.java:78)
14:33:51.032 [ERROR] [org.gradle.api.Project] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
14:33:51.032 [ERROR] [org.gradle.api.Project] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
14:33:51.032 [ERROR] [org.gradle.api.Project] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
14:33:51.034 [ERROR] [org.gradle.api.Project] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
14:33:51.034 [ERROR] [org.gradle.api.Project] at com.android.dx.command.dexer.Main.processOne(Main.java:596)
14:33:51.034 [ERROR] [org.gradle.api.Project] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
14:33:51.034 [ERROR] [org.gradle.api.Project] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
14:33:51.035 [ERROR] [org.gradle.api.Project] at com.android.dx.command.dexer.Main.run(Main.java:230)
14:33:51.035 [ERROR] [org.gradle.api.Project] at com.android.dx.command.dexer.Main.main(Main.java:199)
14:33:51.035 [ERROR] [org.gradle.api.Project] at com.android.dx.command.Main.main(Main.java:103)
我正在使用Scala 2.9.3
但遇到与2.10.x
相同的问题。
这是我的build.gradle
。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
// Scala.
compile 'org.scala-lang:scala-library:2.9.3',
'org.scala-lang:scala-compiler:2.9.3'
}
是否有人使用Gradle + Scala成功编译Android项目。
谢谢!
答案 0 :(得分:0)
看起来你正试图dex整个Scala库。这里有2个选项: