8
似乎存在內存泄漏的地方。將Scala與Gradle for Android項目結合使用
當設置在的IntelliJ的項目,並使用搖籃包裝:
./gradlew assembleDebug --debug
我拿到後約5分鐘以下:我使用Scala 2.9.3
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)
,但遇到了同樣的問題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項目。
謝謝!
這是一個示例項目,我發現可能有些幫助。 https://github.com/yareally/android-scala-intellij-no-sbt-plugin – vaughan
您仍然可以創建Intellij + Scala + Android(非Gradle)項目。只需添加scala特定的proguard文件,你就可以走了。 –
感謝隊友。想想我可能會採取這種方法。 Gradle雖然看起來很有趣。 – vaughan