scala-android / sbt-android

An easy-to-use sbt plugin for working with all Android projects
Other
741 stars 94 forks source link

neverending dex step #189

Closed scalway closed 9 years ago

scalway commented 9 years ago

First build after clean is OK. But when try build it again it never stop dexing process. I see it in every version after 1.3.20 (i stock in this version of plugin).

Here is log from version 1.3.21 (but 1.4.5 behaves in the same way):

first time:

...
[info] Creating proguard cache: proguard-cache-62dcf82c5633075b601629ea398c13d6deed3a2b.jar
[info] Generating dex, incremental=false, multiDex=false
[info] Packaged: app-debug-unaligned.apk (3,78MB)
[info] Debug package does not need signing: app-debug-unaligned.apk
...

second time:

...
[warn] UPDATE: A newer android-sdk-plugin is available: 1.4.5, currently running: 1.3.21
[info] [debug] cache hit, skipping proguard!
[info] Generating dex, incremental=false, multiDex=false
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
    at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
    at java.lang.StringBuilder.<init>(StringBuilder.java:89)
    at com.android.dx.rop.type.Prototype.withFirstParameter(Prototype.java:370)
    at com.android.dx.rop.code.Rops.ropFor(Rops.java:1231)
    at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:490)
    at com.android.dx.cf.code.Simulator$SimVisitor.visitConstant(Simulator.java:691)
    at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:772)
    at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94)
    at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:787)
    at com.android.dx.cf.code.Ropper.doit(Ropper.java:742)
    at com.android.dx.cf.code.Ropper.convert(Ropper.java:349)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:280)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)
    at com.android.dx.command.dexer.Main.processClass(Main.java:729)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
    at com.android.dx.command.dexer.Main.access$300(Main.java:83)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:632)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)

in 1.3.20 it just work:

first time:

...
[info] Creating proguard cache: proguard-cache-62dcf82c5633075b601629ea398c13d6deed3a2b.jar
[info] Generating dex, incremental=false, multiDex=false
[info] Packaged: app-debug-unaligned.apk (3,78MB)
[info] Debug package does not need signing: app-debug-unaligned.apk
[info] zipaligned: app-debug.apk
...

second time:

...
[warn] UPDATE: A newer android-sdk-plugin is available: 1.4.5, currently running: 1.3.20
[info] Compiling 1 Scala source to **/android/code/target/android-bin/classes...
[info] Packaging **/android/code/target/android-bin/classes.jar ...
[info] Done packaging.
[info] Finding dependency references for: classes.jar
[info] [debug] cache hit, skipping proguard!
[info] Generating dex, incremental=true, multiDex=false
Result compacted from 9331,0KiB to 7113,2KiB to save 2217,8KiB
Merged dex A (8 defs/13,7KiB) with dex B (5971 defs/7104,4KiB). Result is 5971 defs/7113,2KiB. Took 1,8s
[info] Packaged: app-debug-unaligned.apk (3,80MB)
[info] Debug package does not need signing: app-debug-unaligned.apk
...

maybe problem is in my build.sbt (I have no idea where it could be) It looks something like this:

android.Plugin.androidBuild
name := "appname"
versionCode := Some(2)
version := "0.0.2"
scalaVersion := "2.11.6"
platformTarget in Android := "android-21"
buildToolsVersion in Android := Some("22.1.2")
targetSdkVersion in Android := "21"
minSdkVersion in Android := "14"
debugIncludesTests in Android := false
instrumentTestRunner in Android := "android.support.test.runner.AndroidJUnitRunner"
resolvers ++= Seq(
  "jcenter" at "http://jcenter.bintray.com",
  "RoboTest releases" at "https://raw.github.com/zbsz/mvn-repo/master/releases/"
)
libraryDependencies ++= Seq (
  "io.reactivex" %  "rxandroid" % "0.22.0",
  "io.reactivex" %% "rxscala" % "0.22.0",
  aar("org.macroid" %% "macroid" % "2.0.0-M4"),
  aar("org.macroid" %% "macroid-viewable" % "2.0.0-M4")
)
libraryDependencies ++= Seq (
  "me.dm7.barcodescanner" % "zxing" % "1.4",
  "se.emilsjolander" % "StickyScrollViewItems" % "1.1.0",
  "com.github.nicolasjafelle" % "paginglistview" % "1.2",
  "com.mcxiaoke.volley" % "library" % "1.0.9",
  "com.fasterxml.jackson.core" % "jackson-core" % "2.4.0",
  "com.fasterxml.jackson.core" % "jackson-annotations" % "2.4.0",
  "com.fasterxml.jackson.core" % "jackson-databind" % "2.4.0",
  "org.androidannotations" % "androidannotations" % "3.3.1" % "provided",
  "org.androidannotations" % "androidannotations-api" % "3.3.1",
  aar("com.flaviofaria" % "kenburnsview" % "1.0.6")
)
libraryDependencies ++= Seq (
  aar("com.android.support" % "support-v4" % "21.0.0"),
  aar("com.android.support" % "recyclerview-v7" % "21.0.0"),
  aar("com.android.support" % "appcompat-v7" % "21.0.0"),
  aar("com.google.maps.android" % "android-maps-utils" % "0.3.4"),
  aar("com.google.android.gms" % "play-services" % "6.5.87"),
  "com.android.support.test.espresso" % "espresso-core" % "2.0",
  "com.android.support.test" % "testing-support-lib" % "0.1",
  "junit" % "junit" % "4.11" % "test",
  "org.scalatest" %% "scalatest" % "2.2.3" % "test",
  "com.geteit" %% "robotest" % "0.7" % "test",
  "org.robolectric" % "android-all" % "5.0.0_r2-robolectric-0" % "test"
)
exportJars in Test := false
fork in Test := false
parallelExecution in Test := false
useProguardInDebug in Android := true
useProguard in Android := true
retrolambdaEnable in Android := false
proguardConfig in Android ++= IO.readLines( file("proguard.txt") )
dexMaxHeap in Android := "1104m"
typedResources in Android := false```
pfn commented 9 years ago

Increase dexMaxHeap

Sent from my phone On Jul 16, 2015 1:58 AM, "agapep" notifications@github.com wrote:

First build after clean is OK. But when try build it again it never stop dexing process. I see it in every version after 1.3.20 (i stock in this version of plugin). Here is log from version 1.3.21 (but 1.4.5 behaves in the same way):

first time:

... [info] Creating proguard cache: proguard-cache-62dcf82c5633075b601629ea398c13d6deed3a2b.jar [info] Generating dex, incremental=false, multiDex=false [info] Packaged: app-debug-unaligned.apk (3,78MB) [info] Debug package does not need signing: app-debug-unaligned.apk ...

second time:

... [warn] UPDATE: A newer android-sdk-plugin is available: 1.4.5, currently running: 1.3.21 [info] [debug] cache hit, skipping proguard! [info] Generating dex, incremental=false, multiDex=false UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap space at java.lang.AbstractStringBuilder.(AbstractStringBuilder.java:68) at java.lang.StringBuilder.(StringBuilder.java:89) at com.android.dx.rop.type.Prototype.withFirstParameter(Prototype.java:370) at com.android.dx.rop.code.Rops.ropFor(Rops.java:1231) at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:490) at com.android.dx.cf.code.Simulator$SimVisitor.visitConstant(Simulator.java:691) at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:772) at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94) at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:787) at com.android.dx.cf.code.Ropper.doit(Ropper.java:742) at com.android.dx.cf.code.Ropper.convert(Ropper.java:349) at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:280) at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137) at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93) at com.android.dx.command.dexer.Main.processClass(Main.java:729) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673) at com.android.dx.command.dexer.Main.access$300(Main.java:83) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:632) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280) at com.android.dx.command.dexer.Main.run(Main.java:246) at com.android.dx.command.dexer.Main.main(Main.java:215) at com.android.dx.command.Main.main(Main.java:106)

in 1.3.20 it just work:

first time:

... [info] Creating proguard cache: proguard-cache-62dcf82c5633075b601629ea398c13d6deed3a2b.jar [info] Generating dex, incremental=false, multiDex=false [info] Packaged: paylo-debug-unaligned.apk (3,78MB) [info] Debug package does not need signing: paylo-debug-unaligned.apk [info] zipaligned: paylo-debug.apk ...

second time:

... [warn] UPDATE: A newer android-sdk-plugin is available: 1.4.5, currently running: 1.3.20 [info] Compiling 1 Scala source to /home/slovic/Projekty/paylo/android/code/target/android-bin/classes... [info] Packaging /home/slovic/Projekty/paylo/android/code/target/android-bin/classes.jar ... [info] Done packaging. [info] Finding dependency references for: classes.jar [info] [debug] cache hit, skipping proguard! [info] Generating dex, incremental=true, multiDex=false Result compacted from 9331,0KiB to 7113,2KiB to save 2217,8KiB Merged dex A (8 defs/13,7KiB) with dex B (5971 defs/7104,4KiB). Result is 5971 defs/7113,2KiB. Took 1,8s [info] Packaged: app-debug-unaligned.apk (3,80MB) [info] Debug package does not need signing: app-debug-unaligned.apk ...

maybe problem is in my build.sbt (I have no idea where it could be) It looks something like this:

android.Plugin.androidBuild name := "appname" versionCode := Some(2) version := "0.0.2" scalaVersion := "2.11.6" platformTarget in Android := "android-21" buildToolsVersion in Android := Some("22.1.2") targetSdkVersion in Android := "21" minSdkVersion in Android := "14" debugIncludesTests in Android := false instrumentTestRunner in Android := "android.support.test.runner.AndroidJUnitRunner" resolvers ++= Seq( "jcenter" at "http://jcenter.bintray.com", "RoboTest releases" at "https://raw.github.com/zbsz/mvn-repo/master/releases/" ) libraryDependencies ++= Seq ( "io.reactivex" % "rxandroid" % "0.22.0", "io.reactivex" %% "rxscala" % "0.22.0", aar("org.macroid" %% "macroid" % "2.0.0-M4"), aar("org.macroid" %% "macroid-viewable" % "2.0.0-M4") ) libraryDependencies ++= Seq ( "me.dm7.barcodescanner" % "zxing" % "1.4", "se.emilsjolander" % "StickyScrollViewItems" % "1.1.0", "com.github.nicolasjafelle" % "paginglistview" % "1.2", "com.mcxiaoke.volley" % "library" % "1.0.9", "com.fasterxml.jackson.core" % "jackson-core" % "2.4.0", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.4.0", "com.fasterxml.jackson.core" % "jackson-databind" % "2.4.0", "org.androidannotations" % "androidannotations" % "3.3.1" % "provided", "org.androidannotations" % "androidannotations-api" % "3.3.1", aar("com.flaviofaria" % "kenburnsview" % "1.0.6") ) libraryDependencies ++= Seq ( aar("com.android.support" % "support-v4" % "21.0.0"), aar("com.android.support" % "recyclerview-v7" % "21.0.0"), aar("com.android.support" % "appcompat-v7" % "21.0.0"), aar("com.google.maps.android" % "android-maps-utils" % "0.3.4"), aar("com.google.android.gms" % "play-services" % "6.5.87"), "com.android.support.test.espresso" % "espresso-core" % "2.0", "com.android.support.test" % "testing-support-lib" % "0.1", "junit" % "junit" % "4.11" % "test", "org.scalatest" %% "scalatest" % "2.2.3" % "test", "com.geteit" %% "robotest" % "0.7" % "test", "org.robolectric" % "android-all" % "5.0.0_r2-robolectric-0" % "test" ) exportJars in Test := false fork in Test := false parallelExecution in Test := false useProguardInDebug in Android := true useProguard in Android := true retrolambdaEnable in Android := false proguardConfig in Android ++= IO.readLines( file("proguard.txt") ) dexMaxHeap in Android := "1104m" typedResources in Android := false```

— Reply to this email directly or view it on GitHub https://github.com/pfn/android-sdk-plugin/issues/189.

scalway commented 9 years ago

I tried this but without results: first time everything looks ok. Second compilation looks like that:

> android:run
...
[info] [debug] cache hit, skipping proguard!
[info] Generating dex, incremental=false, multiDex=false

trouble writing output: Too many method references: 92617; max is 65536.
You may try using --multi-dex option.
References by package:
     6 android.accessibilityservice
     8 android.accounts
    14 android.animation
   328 android.app
   205 android.content
...
    13 java.lang.ref
    98 java.lang.reflect
    61 java.math
    66 java.net
    48 java.nio
     5 java.nio.channels
     8 java.nio.charset
    22 java.security
     1 java.security.spec
     5 java.sql
    30 java.text
...
     2 scala.tools.nsc.plugins
     1 scala.tools.nsc.reporters
     2 scala.tools.nsc.settings
   124 scala.util
    19 scala.util.control
    32 scala.util.hashing
     9 scala.util.matching
    18 sun.misc
     6 sun.nio.cs
[trace] Stack trace suppressed: run last android:dex for the full output.
[error] (android:dex) com.android.ide.common.process.ProcessException: error code: 2
[error] Total time: 100 s, completed 2015-07-16 19:06:58

I don't know what should be result of dexInputs but for me it is weird: first time:

> show android:dexInputs
...
... compile, proguard and other stuff
...
Copying resources from program jar [/[home]/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.1.jar] (filtered)
[info] Creating proguard cache: proguard-cache-316783baaddb9bcd83a430b905e75417925c7066.jar
[info] (false,List(/[home]/[app]/android/code/target/android-bin/classes.proguard.jar))

second time:

> show android:dexInputs
[info] [debug] cache hit, skipping proguard!
[info] (false,List(/[home]/[app]/android/code/target/android-bin/retrolambda-processed.jar,
/[home]/.ivy2/cache/io.reactivex/rxandroid/jars/rxandroid-0.22.0.jar,
/[home]/[app]/android/code/target/aars/com.android.support-recyclerview-v7-21.0.0/com.android.support-recyclerview-v7-21.0.0.jar,
/[home]/.ivy2/cache/org.hamcrest/hamcrest-library/jars/hamcrest-library-1.1.jar,
/[home]/[app]/android/code/target/streams/android/proguardInputs/$global/streams/proguard_cache/proguard-cache-316783baaddb9bcd83a430b905e75417925c7066.jar,
/[home]/[app]/android/code/target/android-bin/classes.jar,
/[home]/[app]/android/code/target/aars/com.github.nicolasjafelle-paginglistview-1.2/com.github.nicolasjafelle-paginglistview-1.2.jar,
/[home]/[app]/android/code/target/aars/com.flaviofaria-kenburnsview-1.0.6/com.flaviofaria-kenburnsview-1.0.6.jar,
/[home]/.ivy2/cache/io.reactivex/rxscala_2.11/jars/rxscala_2.11-0.22.0.jar,
/[home]/[app]/android/code/target/aars/org.macroid-macroid-viewable_2.11-2.0.0-M4/org.macroid-macroid-viewable_2.11-2.0.0-M4.jar,
/[home]/.ivy2/cache/com.fasterxml.jackson.core/jackson-databind/bundles/jackson-databind-2.4.0.jar,
/[home]/[app]/android/code/target/aars/com.google.android.gms-play-services-6.5.87/com.google.android.gms-play-services-6.5.87.jar,
/[home]/[app]/android/code/target/aars/me.dm7.barcodescanner-core-1.3/me.dm7.barcodescanner-core-1.3.jar,
/[home]/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/bundles/jackson-annotations-2.4.0.jar,
/[home]/.ivy2/cache/org.hamcrest/hamcrest-integration/jars/hamcrest-integration-1.1.jar,
/[home]/.ivy2/cache/io.reactivex/rxjava/jars/rxjava-1.0.0-rc.6.jar,
/[home]/[app]/android/code/target/aars/se.emilsjolander-StickyScrollViewItems-1.1.0/se.emilsjolander-StickyScrollViewItems-1.1.0.jar,
/[home]/.ivy2/cache/com.mcxiaoke.volley/library/jars/library-1.0.9.jar,
/[home]/.ivy2/cache/com.sun.codemodel/codemodel/jars/codemodel-2.6.jar,
/[home]/Dev/android-sdk/extras/android/m2repository/com/android/support/support-annotations/21.0.3/support-annotations-21.0.3.jar,
/[home]/[app]/android/code/target/aars/com.android.support.test.espresso-espresso-idling-resource-2.0/com.android.support.test.espresso-espresso-idling-resource-2.0.jar,
/[home]/[app]/android/code/target/aars/com.android.support-appcompat-v7-21.0.0/com.android.support-appcompat-v7-21.0.0.jar,
/[home]/.ivy2/cache/org.hamcrest/hamcrest-core/jars/hamcrest-core-1.1.jar,
/[home]/.ivy2/cache/javax.annotation/javax.annotation-api/jars/javax.annotation-api-1.2.jar,
/[home]/.ivy2/cache/org.androidannotations/androidannotations-api/jars/androidannotations-api-3.3.1.jar,
/[home]/.ivy2/cache/org.brianmckenna/wartremover_2.11/jars/wartremover_2.11-0.10.jar,
/[home]/[app]/android/code/target/aars/me.dm7.barcodescanner-zxing-1.4/me.dm7.barcodescanner-zxing-1.4.jar,
/[home]/.ivy2/cache/com.fasterxml.jackson.core/jackson-core/bundles/jackson-core-2.4.0.jar,
/[home]/[app]/android/code/target/aars/com.android.support.test.espresso-espresso-core-2.0/com.android.support.test.espresso-espresso-core-2.0.jar,
/[home]/[app]/android/code/target/aars/com.android.support.test-testing-support-lib-0.1/com.android.support.test-testing-support-lib-0.1.jar,
/[home]/[app]/android/code/target/aars/org.macroid-macroid_2.11-2.0.0-M4/org.macroid-macroid_2.11-2.0.0-M4.jar,
/[home]/.ivy2/cache/javax.inject/javax.inject/jars/javax.inject-1.jar,
/[home]/.ivy2/cache/com.google.code.findbugs/jsr305/jars/jsr305-2.0.1.jar,
/[home]/.ivy2/cache/com.squareup/javawriter/jars/javawriter-2.1.1.jar,
/[home]/[app]/android/code/target/aars/com.google.maps.android-android-maps-utils-0.3.4/com.google.maps.android-android-maps-utils-0.3.4.jar,
/[home]/.ivy2/cache/com.google.zxing/core/jars/core-3.1.0.jar,
/[home]/[app]/android/code/target/aars/com.android.support-support-v4-21.0.3/com.android.support-support-v4-21.0.3.jar,
/[home]/[app]/android/code/target/aars/com.android.support-support-v4-21.0.3/libs/internal_impl-21.0.3.jar,
/[home]/.ivy2/cache/junit/junit-dep/jars/junit-dep-4.10.jar))

any ideas?

pfn commented 9 years ago

Your proguardCache is misconfigured, fix it.

On Thu, Jul 16, 2015 at 10:40 AM, agapep notifications@github.com wrote:

I tried this but without results:

[info] [debug] cache hit, skipping proguard! [info] Generating dex, incremental=false, multiDex=false

trouble writing output: Too many method references: 92617; max is 65536. You may try using --multi-dex option. References by package: 6 android.accessibilityservice 8 android.accounts 14 android.animation 328 android.app 205 android.content ... 13 java.lang.ref 98 java.lang.reflect 61 java.math 66 java.net 48 java.nio 5 java.nio.channels 8 java.nio.charset 22 java.security 1 java.security.spec 5 java.sql 30 java.text ... 2 scala.tools.nsc.plugins 1 scala.tools.nsc.reporters 2 scala.tools.nsc.settings 124 scala.util 19 scala.util.control 32 scala.util.hashing 9 scala.util.matching 18 sun.misc 6 sun.nio.cs [trace] Stack trace suppressed: run last android:dex for the full output. error com.android.ide.common.process.ProcessException: error code: 2 [error] Total time: 100 s, completed 2015-07-16 19:06:58

It seems that the proguard cache is not working propertly. I don't know what should be result of dexInputs but for me it is wird: first time:

show android:dexInputs ... ... compile, proguard and other stuff ... Copying resources from program jar /home/slovic/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.1.jar [info] Creating proguard cache: proguard-cache-316783baaddb9bcd83a430b905e75417925c7066.jar info

second time:

show android:dexInputs [info] [debug] cache hit, skipping proguard! [info](false,List%28/[home]/[app]/android/code/target/android-bin/retrolambda-processed.jar, /[home]/.ivy2/cache/io.reactivex/rxandroid/jars/rxandroid-0.22.0.jar, /[home]/[app]/android/code/target/aars/com.android.support-recyclerview-v7-21.0.0/com.android.support-recyclerview-v7-21.0.0.jar, /[home]/.ivy2/cache/org.hamcrest/hamcrest-library/jars/hamcrest-library-1.1.jar, /[home]/[app]/android/code/target/streams/android/proguardInputs/$global/streams/proguard_cache/proguard-cache-316783baaddb9bcd83a430b905e75417925c7066.jar, /[home]/[app]/android/code/target/android-bin/classes.jar, /[home]/[app]/android/code/target/aars/com.github.nicolasjafelle-paginglistview-1.2/com.github.nicolasjafelle-paginglistview-1.2.jar, /[home]/[app]/android/code/target/aars/com.flaviofaria-kenburnsview-1.0.6/com.flaviofaria-kenburnsview-1.0.6.jar, /[home]/.ivy2/cache/io.reactivex/rxscala_2.11/jars/rxscala_2.11-0.22.0.jar, /[home]/[app]/android/code/target/aars/org.macroid-macroid-viewable_2.11-2.0. 0-M4/org .macroid-macroid-viewable_2.11-2.0.0-M4.jar, /[home]/.ivy2/cache/com.fasterxml.jackson.core/jackson-databind/bundles/jackson-databind-2.4.0.jar, /[home]/[app]/android/code/target/aars/com.google.android.gms-play-services-6.5.87/com.google.android.gms-play-services-6.5.87.jar, /[home]/[app]/android/code/target/aars/me.dm7.barcodescanner-core-1.3/me.dm7.barcodescanner-core-1.3.jar, /[home]/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/bundles/jackson-annotations-2.4.0.jar, /[home]/.ivy2/cache/org.hamcrest/hamcrest-integration/jars/hamcrest-integration-1.1.jar, /[home]/.ivy2/cache/io.reactivex/rxjava/jars/rxjava-1.0.0-rc.6.jar, /[home]/[app]/android/code/target/aars/se.emilsjolander-StickyScrollViewItems-1.1.0/se.emilsjolander-StickyScrollViewItems-1.1.0.jar, /[home]/.ivy2/cache/com.mcxiaoke.volley/library/jars/library-1.0.9.jar, /[home]/.ivy2/cache/com.sun.codemodel/codemodel/jars/codemodel-2.6.jar, /[home]/Dev/android-sdk/extras/android/m2repository/com/android/s upport/s upport-annotations/21.0.3/support-annotations-21.0.3.jar, /[home]/[app]/android/code/target/aars/com.android.support.test.espresso-espresso-idling-resource-2.0/com.android.support.test.espresso-espresso-idling-resource-2.0.jar, /[home]/[app]/android/code/target/aars/com.android.support-appcompat-v7-21.0.0/com.android.support-appcompat-v7-21.0.0.jar, /[home]/.ivy2/cache/org.hamcrest/hamcrest-core/jars/hamcrest-core-1.1.jar, /[home]/.ivy2/cache/javax.annotation/javax.annotation-api/jars/javax.annotation-api-1.2.jar, /[home]/.ivy2/cache/org.androidannotations/androidannotations-api/jars/androidannotations-api-3.3.1.jar, /[home]/.ivy2/cache/org.brianmckenna/wartremover_2.11/jars/wartremover_2.11-0.10.jar, /[home]/[app]/android/code/target/aars/me.dm7.barcodescanner-zxing-1.4/me.dm7.barcodescanner-zxing-1.4.jar, /[home]/.ivy2/cache/com.fasterxml.jackson.core/jackson-core/bundles/jackson-core-2.4.0.jar, /[home]/[app]/android/code/target/aars/com.android.support.test.espresso-espre sso-core -2.0/com.android.support.test.espresso-espresso-core-2.0.jar, /[home]/[app]/android/code/target/aars/com.android.support.test-testing-support-lib-0.1/com.android.support.test-testing-support-lib-0.1.jar, /[home]/[app]/android/code/target/aars/org.macroid-macroid_2.11-2.0.0-M4/org.macroid-macroid_2.11-2.0.0-M4.jar, /[home]/.ivy2/cache/javax.inject/javax.inject/jars/javax.inject-1.jar, /[home]/.ivy2/cache/com.google.code.findbugs/jsr305/jars/jsr305-2.0.1.jar, /[home]/.ivy2/cache/com.squareup/javawriter/jars/javawriter-2.1.1.jar, /[home]/[app]/android/code/target/aars/com.google.maps.android-android-maps-utils-0.3.4/com.google.maps.android-android-maps-utils-0.3.4.jar, /[home]/.ivy2/cache/com.google.zxing/core/jars/core-3.1.0.jar, /[home]/[app]/android/code/target/aars/com.android.support-support-v4-21.0.3/com.android.support-support-v4-21.0.3.jar, /[home]/[app]/android/code/target/aars/com.android.support-support-v4-21.0.3/libs/internal_impl-21.0.3.jar, /[home]/.ivy2/cache/jun it/junit -dep/jars/junit-dep-4.10.jar%29)

any ideas?

— Reply to this email directly or view it on GitHub https://github.com/pfn/android-sdk-plugin/issues/189#issuecomment-122031713 .

pfn commented 9 years ago

If you don't know how to fix it, look at the list of packages + method counts, whatever has the highest counts, add it to proguardCache.

If you are unable to decrease the method count sufficiently, you will need to use multidex. (It's rarely impossible, however)

going by your library dependencies, you should at the very least add "com.google.android.gms" and "org.scalatest".

[oops, didn't notice test stuff was in "test" already]

scalway commented 9 years ago

thx. It helps in some way but still I can not run project properly. Now all 'reflect' stuff is broken in every build (except clean one).

Last build took ~10 minutes and terminate with:

UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOfRange(Arrays.java:3658)
    at java.lang.String.<init>(String.java:201)
    at java.lang.String.substring(String.java:1920)
    at com.android.dx.rop.type.Prototype.withFirstParameter(Prototype.java:370)
    at com.android.dx.rop.code.Rops.ropFor(Rops.java:1224)
    at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:490)
    at com.android.dx.cf.code.Simulator$SimVisitor.visitConstant(Simulator.java:691)
    at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:764)
    at com.android.dx.cf.code.Simulator.simulate(Simulator.java:94)
    at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:787)
    at com.android.dx.cf.code.Ropper.doit(Ropper.java:742)
    at com.android.dx.cf.code.Ropper.convert(Ropper.java:349)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:280)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)
    at com.android.dx.command.dexer.Main.processClass(Main.java:729)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
    at com.android.dx.command.dexer.Main.access$300(Main.java:83)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:632)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
[trace] Stack trace suppressed: run last android:dex for the full output.
[error] (android:dex) com.android.ide.common.process.ProcessException: error code: 3
[error] Total time: **683 s**, completed 2015-07-16 21:53:26

I give him

dexMaxHeap in Android := "2104m"

I don't get it. I have no time to fight with it longer. I go back to 1.3.20 for now.

Thanks for help, and great tool. You are awesome :).

pfn commented 9 years ago

You can't use 2104m as max heap if you're not using a 64bit jdk. And on windows, the max heap possible for a 32bit jvm is something around 1500m

nightscape commented 9 years ago

I'm running into the same problem. As described by @agapep, everything works nicely if I perform a clean first, but fails with an OOM on all non-cleaned runs. I'm also observing the same behaviour w.r.t. show android:dexInputs where the first run will show a single target/android-bin/classes.proguard.jar while non-cleaned runs show all jar dependencies. @pfn, you mentioned that @agapep's proguardCache might be misconfigured, do you have an idea which misconfiguration can lead to this problem? In my case, I have the following related settings (64-bit JDK):

dexMaxHeap := "3072m"

proguardCache in Android ++= Seq(
  "com.google.android.gms",
  "android.support"
)

The full configuration is here, I'm happy about all hints what I'm doing wrong that causes those OOMs :) https://github.com/dei-tasks/dei-tasks-android/blob/master/build.sbt

pfn commented 9 years ago

dexMaxHeap in Android

nightscape commented 9 years ago

Ok, my bad, should have RTFM more thoroughly... After using the correct setting and proguardCacheing the packages with the highest number of methods everything works as expected. Thanks Perry!