Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/client/DefaultHttpClient
I am not able to resolve below error :
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/client/DefaultHttpClient; at com.medicend.jykra.medicend.Async.Parser.LoginParser.hitWS(LoginParser.java:68) at com.medicend.jykra.medicend.Async.Parser.LoginParser.postData(LoginParser.java:50) at com.medicend.jykra.medicend.Activity.SignInActivity$LoginAsync.doInBackground(SignInActivity.java:91) at com.medicend.jykra.medicend.Activity.SignInActivity$LoginAsync.doInBackground(SignInActivity.java:73) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.impl.client.DefaultHttpClient" on path: DexPathList[[zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/base.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_resources_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/lib/x86, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.medicend.jykra.medicend.Async.Parser.LoginParser.hitWS(LoginParser.java:68) at com.medicend.jykra.medicend.Async.Parser.LoginParser.postData(LoginParser.java:50) at com.medicend.jykra.medicend.Activity.SignInActivity$LoginAsync.doInBackground(SignInActivity.java:91) at com.medicend.jykra.medicend.Activity.SignInActivity$LoginAsync.doInBackground(SignInActivity.java:73) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.medicend.jykra.medicend-IiBcrMY7QQm4ixa9RIMICQ==/split_lib_resources_apk.apk at dalvik.system.DexFile.openDexFileNative(Native Method) at dalvik.system.DexFile.openDexFile(DexFile.java:354) at dalvik.system.DexFile.(DexFile.java:101) at dalvik.system.DexFile.(DexFile.java:75) at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394) at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354) at dalvik.system.DexPathList.(DexPathList.java:164) at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:74) at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:65) at dalvik.system.PathClassLoader.(PathClassLoader.java:64) at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73) E/AndroidRuntime: at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40) at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727) at android.app.LoadedApk.getClassLoader(LoadedApk.java:810) at android.app.LoadedApk.getResources(LoadedApk.java:1032) at android.app.ContextImpl.createAppContext(ContextImpl.java:2345) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749) at android.app.ActivityThread.access$1100(ActivityThread.java:199) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
You can fix NoClassDefFoundError error by checking following: Check the exception stack trace to know exactly which class throw the error and which is the class not found by java.
It is thrown by the Java Runtime System when the class definition is not found at run time. Developers can handle an exception using a try and catch block or any other method for preventing the program from crashing. The program will crash whenever NoClassDefFoundError will occur.
NoClassDefFoundError is a common error in Java that occurs if a ClassLoader cannot find a particular class in the classpath while trying to load it. The Exception in thread "main" suggests that this error has occurred in the main thread, the thread which is responsible for running the Java application.
Just like ClassNotFoundException, NoClassDefFoundError occurs at runtime. We get this error when the class is not available in the program at runtime. It is an unchecked exception which a program throws when the requested class is not present at runtime.
Add the following to your manifest file under 'application':
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With