AndroidProguardScala icon indicating copy to clipboard operation
AndroidProguardScala copied to clipboard

StringBuilder

Open tculshaw opened this issue 12 years ago • 5 comments

I get a java.lang.NoClassDefFoundError: scala.collection.mutable.StringBuilder

based on a straightforward ....

val textViewCounter = findViewById(R.id.textViewCounter).asInstanceOf[TextView] textViewCounter.setText("This app has been started " + counter + " times.");

I am running Eclipse Juno + Scala 2.10.1 + Android 4.1.2 + AndroidProguardScala 47.2...

I have tried adding the following to proguard_cache_conf/proguard_additions.conf...

-keep class scala.collection.mutable.StringBuilder { *; }

Any ideas?

tculshaw avatar May 20 '13 05:05 tculshaw

Oooooh!

An update on this, I started a brand new project and the problem no longer occurs, so what I need to figure out is what is breaking.

First step was to take the generated scala_library.min.jar from the working project and just plonk it into the broken project (while disabling the proguard builder). I included the jar in the java build path, so it gets included.

Same error, ie. java.lang.NoClassDefFoundError: scala.collection.mutable.StringBuilder

I also looked in the original scala_library.min.jar and stuff is definitely in there, I don't even need the -keep class scala.collection.mutable.StringBuilder { *; } because it's already there.

Any suggestions on how to troubleshoot?

tculshaw avatar May 21 '13 05:05 tculshaw

@tculshaw Not sure if it will help to spot the problem, but you can try to look at disassembled dex file and check what's happening there...

magicgoose avatar May 21 '13 10:05 magicgoose

Well that's "solved" the problem.

Suggest add this to troubleshooting....

If the scala_library.min.jar is built AND it's zero in size, then there's a problem with the generation - I actually had a thrid party corrupt jar file which proguard was bombing out on.

If the scala_library.min.jar is built AND it's none zero in size, then there's a problem with the steps after proguard generation. For me it wa sthe upgrade to ADT 22 which trashes existing eclipse android projects. Check your bin/dexedLibs. At least two dex files need to be in there, namely android-support-vXXX.. and scala_library.min-.... If bin/dexedLibs. If that directory is empty, then you need to make sure "Android Private Libraries" is checked to export. If that STILL doesn't work try starting a new project and copying source and libs back in, ie. a re-assembly of the whole project should resolve the issue.

tculshaw avatar May 21 '13 21:05 tculshaw

Sounds like you've got it figured out. There's actually a bug fix in master that should detect proguard failures better than the current release, but I haven't pushed it out yet. (Well, I sort of have pushed it out; there was an attempt to get AndroidProguardScala into the Scala ecosystem, but it's stalled.)

It sounds like I also need to check out what's going on with ADT 22.

banshee avatar May 22 '13 01:05 banshee

Thanks, checking the Android Private Libraries solved my issue!

HannahRose avatar Jun 20 '13 19:06 HannahRose