Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringBuilder #46

Open
tculshaw opened this issue May 20, 2013 · 5 comments
Open

StringBuilder #46

tculshaw opened this issue May 20, 2013 · 5 comments
Assignees

Comments

@tculshaw
Copy link

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
Copy link
Author

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?

@magicgoose
Copy link

@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...

@tculshaw
Copy link
Author

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.

@ghost ghost assigned banshee May 22, 2013
@banshee
Copy link
Owner

banshee commented May 22, 2013

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.

@HannahRose
Copy link

Thanks, checking the Android Private Libraries solved my issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants