Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoClassDefFoundError for retrofit.RestAdapter$Builder

I'm using Android Studio and I would like to use Retrofit, a rest client for Android and Java.

I added retrofit in dependencies of my build.gradle file. So, I can use it on my project but when I would like to execute it, I have a NoClassDefFoundError for retrofit.RestAdapter$Builder inner class.

dependencies {
    compile 'com.squareup.retrofit:retrofit:1.3.0'
}

Thanks in advance for your help.

Edit for solution :

  1. Updates your Android Studio to 4.0+
  2. Enables annotations in Preferences > Compiler > Annotation Processors > Enable Annotation processing.
like image 483
Gerard Paligot Avatar asked Nov 28 '25 14:11

Gerard Paligot


1 Answers

Retrofit requires annotation processing. Try

   dependencies {
     apt 'com.squareup.retrofit:retrofit:1.3.0'
     compile 'com.squareup.retrofit:retrofit:1.3.0'
   }

Check out this post for a similar situation: Android Studio 0.4 & Butter Knife

like image 132
quinnjn Avatar answered Nov 30 '25 03:11

quinnjn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!