3

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.

1 Answers1

1

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

Community
  • 1
  • 1
quinnjn
  • 623
  • 7
  • 10