JoCuTo
JoCuTo

Reputation: 2483

Getting crash using okhttp 2.7

I am trying to use retrofit 1.9 in one of my project on Android Studio 2.0 on Ubuntu . Those are my dependencies

    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'net.danlew:android.joda:2.7.1'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
  //compile 'com.squareup.okhttp:okhttp:2.7.0'

As you can see I have commented this line and the app works

//compile 'com.squareup.okhttp:okhttp:2.7.0'

Uncommenting that line and running the project the app crashes and I get this error

FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.google.android.gms.R$string at com.google.android.gms.measurement.zza.(Unknown Source) at com.google.android.gms.measurement.zza.zzaR(Unknown Source) at com.google.android.gms.measurement.internal.zzn.zziJ(Unknown Source) at com.google.android.gms.measurement.internal.zzz.zza(Unknown Source) at com.google.android.gms.measurement.internal.zzw.(Unknown Source) at com.google.android.gms.measurement.internal.zzaa.zzDj(Unknown Source) at com.google.android.gms.measurement.internal.zzw.zzaT(Unknown Source) at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source) at android.content.ContentProvider.attachInfo(ContentProvider.java:1058) at android.app.ActivityThread.installProvider(ActivityThread.java:4660) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4290) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4232) at android.app.ActivityThread.access$1400(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4921) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) at dalvik.system.NativeStart.main(Native Method)

Any idea?.
Thanks

Edited and added:

I am trying with

compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.okhttp3:okhttp:3.0.1'

and the same error is getting:

FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.google.android.gms.R$string

Upvotes: 0

Views: 355

Answers (1)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75778

Whats your logcat throws

FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.google.android.gms.R$string at com.google.android.gms.measurement.zza.(Unknown Source)

NoClassDefFoundError. This error is thrown when the Java Virtual Machine (JVM) or an instance of the ClassLoader class tries to load the definition of a class, but the definition could not be found. It extends the LinkageError class, which is used to indicate error cases, where a class has a dependency on some other class and that class has incompatibly changed after the compilation.

For your set up configurations you should use

compile 'com.google.android.gms:play-services:7.8.0'

Then Clean-Build-Restart-Sync Your Project .

Upvotes: 2

Related Questions