I\'m using Retrofit to handle the Serverside Data from Mobile. After Implementing retrofit, I am Getting the below Exception.
What am I doing wrong?
With these many library saddles up, it must have exceded the infamous 64k method limit, you need to enable your app for multidex. Here is how you do it. https://developer.android.com/tools/building/multidex.html
It's Gradle bulid configure issue i also got same issue Some times
In Gradle your using
compile 'com.google.android.gms:play-services:8.4.0'
Enire Google Playservice Lib can you change into which are the lib's using in your project
Example
com.google.android.gms:play-services-gcm:8.4.0
com.google.android.gms:play-services-maps:8.4.0
com.google.android.gms:play-services-auth:8.4.0
Refer This URl https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project
Did you add the following proguard rules?
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
Documentation: http://square.github.io/retrofit/
mRetrofit = new Retrofit.Builder()
.baseUrl(AppConstance.APP_URL)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(getOkHttpClient())
.build();
REWRITE TO
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
mRetrofit = new Retrofit.Builder()
.baseUrl(AppConstance.APP_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(httpClient)
.build();
Try using the same lib version for base retrofit lib and the converters.
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-scalars:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'