intellij idea – NoClassDefFoundError with libraries in Android Studio-ThrowExceptions

Exception or error:

I’ve spent hours trying to get a library to work with my project in Android Studio, and I just can’t figure it out.

Here’s what my dependencies look like for my module
enter image description here

And my libraries:

I’ve even added

compile files('libs/signpost-commonshttp4-')
compile files('libs/signpost-core-')

to my build.gradle. Without this, the app would not even compile.

At this stage, when I try to reference one of the libraries in code, the app crashes with a NoClassDefFoundError exception.

Something tells me this shouldn’t be this hard – what am I overlooking?


05-17 21:51:15.676: I/ActivityManager(714): START u0 {flg=0x10104000 cmp=com.crazydog.splitwiser/.InitialSplash bnds=[328,402][656,692]} from pid 1513
05-17 21:51:15.896: I/ActivityManager(714): Start proc com.crazydog.splitwiser for activity com.crazydog.splitwiser/.InitialSplash: pid=18174 uid=10288 gids={50288, 3003, 1028}
05-17 21:51:16.326: I/ActivityManager(714): Displayed com.crazydog.splitwiser/.InitialSplash: +437ms (total +1m9s209ms)
05-17 21:51:17.017: I/ActivityManager(714): START u0 {cmp=com.crazydog.splitwiser/.LogIn} from pid 18174
05-17 21:51:17.097: E/dalvikvm(18174): Could not find class 'oauth.signpost.commonshttp.CommonsHttpOAuthConsumer', referenced from method com.crazydog.splitwiser.Toolkit.oAuthTransaction
05-17 21:51:17.097: W/dalvikvm(18174): VFY: unable to resolve new-instance 662 (Loauth/signpost/commonshttp/CommonsHttpOAuthConsumer;) in Lcom/crazydog/splitwiser/Toolkit;
05-17 21:51:17.097: D/dalvikvm(18174): DexOpt: unable to opt direct call 0x112f at 0x08 in Lcom/crazydog/splitwiser/Toolkit;.oAuthTransaction
05-17 21:51:17.107: E/AndroidRuntime(18174):    at com.crazydog.splitwiser.Toolkit.oAuthTransaction(
05-17 21:51:17.107: E/AndroidRuntime(18174):    at com.crazydog.splitwiser.LogIn.onResume(
05-17 21:51:17.117: W/ActivityManager(714):   Force finishing activity com.crazydog.splitwiser/.LogIn
05-17 21:51:17.117: W/ActivityManager(714):   Force finishing activity com.crazydog.splitwiser/.InitialSplash
05-17 21:51:17.618: W/ActivityManager(714): Activity pause timeout for ActivityRecord{40d040d0 u0 com.crazydog.splitwiser/.LogIn}
How to solve:

I had the exact same problem,
And like you i thought it’s enough to add the

compile files('libs/signpost-commonshttp4-')
compile files('libs/signpost-core-')

It all worked after i did a ./gradlew clean (I’m on a mac, so in your case, the equivalent.)
You should do this command from the Terminal/Command prompt when you’re located on the root of your project.

Leave a Reply

Your email address will not be published. Required fields are marked *