android - NoClassDefFoundError for OkHttpClient -


after adding facebook dependency in gradle i'm getting runtime error:

     compile 'com.facebook.android:facebook-android-sdk:4.6.0' 

please notice i'm using okhttp:

    compile 'com.squareup.okhttp:okhttp:2.5.0' 

and error log is:

 e/androidruntime: fatal exception: thread-109754      process: com.venkat.project, pid: 4453             java.lang.noclassdeffounderror: com.squareup.okhttp.internal.util             @ com.squareup.okhttp.okhttpclient.<clinit>(okhttpclient.java:57)             @ com.venkat.project.http.myhttpthread.run(myhttpthread.java:127)             @ com.venkat.project.http.myhttpthread.run(myhttpthread.java:61)             @ java.lang.thread.run(thread.java:841) 02-23 18:11:02.729 4453-4573/com.venkat.project i/dalvikvm: rejecting re-init on previously-failed class lcom/squareup/okhttp/okhttpclient; v=0x0 

note: i'm getting error on samsung mobile 4.4 on emulator , on moto g 5.0 works.

you getting

       java.lang.noclassdeffounderror: com.squareup.okhttp.internal.util         @ com.squareup.okhttp.okhttpclient.<clinit>(okhttpclient.java:57)         @ com.venkat.project.http.myhttpthread.run(myhttpthread.java:127)         @ com.venkat.project.http.myhttpthread.run(myhttpthread.java:61) 

noclassdeffounderror okhttpclient

public class noclassdeffounderror extends linkageerror 

thrown if java virtual machine or classloader instance tries load in definition of class (as part of normal method call or part of creating new instance using new expression) , no definition of class found.

quote noclassdeffounderror

you should use

compile 'com.facebook.android:facebook-android-sdk:4.10.0' 

after can error finished non-zero exit value 2

then

defaultconfig {     ...     minsdkversion 14 //lower 14 doesn't support multidex     targetsdkversion //yours      // enabling multidex support.     multidexenabled true }  dependencies {  compile 'com.android.support:multidex:1.0.0' } 
  1. add multidexenabled true

  2. call compile 'com.android.support:multidex:1.0.0' // or 1.0.1

okhttp perseveres when network troublesome: silently recover common connection problems. if service has multiple ip addresses okhttp attempt alternate addresses if first connect fails. necessary ipv4+ipv6 , services hosted in redundant data centers.

you can call latest version

compile 'com.squareup.okhttp3:okhttp:3.2.0' 

finally

compile 'com.squareup.okhttp3:okhttp:3.0.1' or // compile 'com.squareup.okhttp:okhttp:2.5.0' compile 'com.facebook.android:facebook-android-sdk:4.10.0' 

then

clean , re-build & sync project . hope helps .


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -