jberkel/android-plugin — Issue #121: StringIndexOutOfBoundsException on android.jar
Author: ktoso
Created: 2012-03-06 08:55:51+00:00
State: open

Hi guys,
I've hit a weird problem since two days ago and can't seem to find a solution to it.
It happens in this project: https://github.com/ktoso/smsser-scala/tree/master/smsser-android

```
> android:start-device
[info] generating scrooge thrift for /Users/ktoso/code/smsser/smsser-android/src/main/thrift/hello.thrift...
[info] java -jar /Users/ktoso/code/smsser/smsser-android/project/target/scrooge-2.4.0/scrooge-2.4.0.jar --finagle --ostrich --verbose -d /Users/ktoso/code/smsser/smsser-android/target/scala-2.9.1/src_managed/main/scala -s /Users/ktoso/code/smsser/smsser-android/src/main/thrift/hello.thrift
[info] Wrote /Users/ktoso/code/smsser/smsser-android/target/scala-2.9.1/src_managed/main/scala/pl/project13/smsser/android/TR.scala
+ Compiling /Users/ktoso/code/smsser/smsser-android/src/main/thrift/hello.thrift
[info] Compiling 12 Scala sources and 1 Java source to /Users/ktoso/code/smsser/smsser-android/target/scala-2.9.1/classes...
ProGuard, version 4.6
ProGuard is released under the GNU General Public License. You therefore
must ensure that programs that link to it (scala, ...)
carry the GNU General Public License as well. Alternatively, you can
apply for an exception with the author of ProGuard.
Reading program directory [/Users/ktoso/code/smsser/smsser-android/target/scala-2.9.1/classes]
Reading program jar [/Users/ktoso/.sbt/boot/scala-2.9.1/lib/scala-library.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.google.zxing/android-integration/jars/android-integration-2.0.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/finagle-core_2.9.1/jars/finagle-core_2.9.1-2.0.1.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/util-collection_2.9.1/jars/util-collection_2.9.1-2.0.0.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.google.guava/guava/jars/guava-11.0.2.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.google.code.findbugs/jsr305/jars/jsr305-1.3.9.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/commons-collections/commons-collections/jars/commons-collections-3.2.1.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/util-core_2.9.1/jars/util-core_2.9.1-2.0.0.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/io.netty/netty/bundles/netty-3.3.1.Final.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/util-hashing_2.9.1/jars/util-hashing_2.9.1-2.0.0.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/finagle-thrift_2.9.1/jars/finagle-thrift_2.9.1-2.0.1.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/thrift/libthrift/jars/libthrift-0.5.0.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/scrooge-runtime_2.9.1/jars/scrooge-runtime_2.9.1-1.1.3.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/util-codec_2.9.1/jars/util-codec_2.9.1-1.12.13.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/finagle-ostrich4_2.9.1/jars/finagle-ostrich4_2.9.1-2.0.1.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/ostrich_2.9.1/jars/ostrich_2.9.1-4.10.5.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/json_2.8.1/jars/json_2.8.1-2.1.6.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/util-logging_2.9.1/jars/util-logging_2.9.1-1.12.13.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/com.twitter/util-eval_2.9.1/jars/util-eval_2.9.1-1.12.13.jar] (filtered)
Reading program jar [/Users/ktoso/.sbt/boot/scala-2.9.1/lib/scala-compiler.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/scala_2.9.1/sbt_0.11.2/com.github.mpeltonen/sbt-idea/jars/sbt-idea-1.0.0.jar] (filtered)
Reading program jar [/Users/ktoso/.ivy2/cache/commons-io/commons-io/jars/commons-io-2.0.1.jar] (filtered)
Reading library jar [/Users/ktoso/code/libs/android-sdk-macosx/platforms/android-10/android.jar]
[error] {file:/Users/ktoso/code/smsser/}smsser-android/android:proguard: java.lang.StringIndexOutOfBoundsException: String index out of range: 160
```
I'm a bit baffled on how to avoid thid. I can't disable proguard - dexing takes forever then (and fails with OOMs).
If I start adding -dontoptimize etc it also fails (only "louder").

Any suggestion would be greatly welcome - thanks in advance!

To reproduce:
```
sbt
reload
update
project smsser-android
android:start-emulator
```

good job with the plugin by the way, it's really nice if not for this above problem but that's a proguard issue I guess. :-)