4

I am using Twilio Client Android sdk but failing with this error while try to run it :-

Caused by: java.lang.NoClassDefFoundError: Class "Lcom/twilio/client/impl/useragent/config/UserAgentConfig$Callbacks;" not found 

I have include twilioclient-android-1.1.2-3635733.jar what went wrong anyone

What should be the Order- Current Order

Android 4.4.2
Android Private Libraries
Android Dependencies
Project/gen
Project/src
  • Follow this it may helps you http://stackoverflow.com/questions/8678630/noclassdeffounderror-for-code-in-an-java-library-on-android – Shailendra Madda Feb 18 '14 at 05:40
  • Try adding jar to build path. – DcodeChef Feb 18 '14 at 05:50
  • Can you check the order –  Feb 18 '14 at 06:03
  • Does it has to do something with **** But The app works fine it emulators I have check on three as of 4.2,4.3 and 4.4 it is just that it fails with above error when runned on device not in emulator any guess –  Feb 18 '14 at 09:12
  • Now I have tried ' private static void fixClassLoaderIssue() { ClassLoader myClassLoader = MonkeyPhone.class.getClassLoader(); Thread.currentThread().setContextClassLoader(myClassLoader); }' It doesnt faile with above error it now fail with 'art/runtime/check_jni.cc:64] JNI DETECTED ERROR IN APPLICATION: java_object == null' –  Feb 18 '14 at 10:42

3 Answers3

2

Try this:

project-> config build path-> order and export-> move dependent project on top

and

this error is also generated when you make an app that uses the Google API (such as Maps) but run it on a device that targets the Android API.

thats it.

Shailendra Madda
  • 20,649
  • 15
  • 100
  • 138
  • Hi, shylendra I have tried all possibility from here http://stackoverflow.com/questions/8678630/noclassdeffounderror-for-code-in-an-java-library-on-android but I am checking it for hours and hours now but is still there by the way I am getting this error with ANDROID Twilio Client sdk have you worked with Twilio lib before –  Feb 19 '14 at 09:17
  • @shivam singh No, sorry for that – Shailendra Madda Feb 19 '14 at 09:23
1

In case you're using Proguard i.e, if minifyEnabled is set to true in the build.gradle file, then it is possible that Proguard is obfuscating your code. So make sure you use the Proguard rules for Twillio, as written in the Twilio docs:

-keep class com.twilio.** { *; }
Ashish Ranjan
  • 5,523
  • 2
  • 18
  • 39
0

Just check you runtime in 'developer options' -> 'select runtime' if you use ART just change it to Dalvik to avoid this error. Maybe it's not a solution for you but I didn't find another way to fix this error.

Nikolay Nikiforchuk
  • 1,998
  • 24
  • 20