简体   繁体   中英

NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory

Error:

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: com.azail.cart.debug, PID: 2403
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:354)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        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.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory;
        at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:159)
        at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:178)
        at com.azail.cart.connections.ConnectionClass.getRequest(ConnectionClass.java:240)
        at com.azail.cart.connections.AppCacheConnections.getAllDetailsOfApp(AppCacheConnections.java:33)
        at com.azail.cart.SplashActivity$1.doInBackground(SplashActivity.java:159)
        at com.azail.cart.SplashActivity$1.doInBackground(SplashActivity.java:146)
        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.commons.logging.LogFactory" on path: DexPathList[[zip file "/data/app/com.azail.cart.debug-a_b6vv5iBpFhYtgRldECJg==/base.apk"],nativeLibraryDirectories=[/data/app/com.azail.cart.debug-a_b6vv5iBpFhYtgRldECJg==/lib/arm64, /system/lib64]]
        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 org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:159) 
        at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:178) 
        at com.azail.cart.connections.ConnectionClass.getRequest(ConnectionClass.java:240) 
  • Situation : So I debugged and found that the first api call im doing in which using

    HttpClient httpclient = new DefaultHttpClient();

    the next step its going to AsyncTask public AsyncTask(@Nullable Looper callbackLooper) { 's catch block and displaying above error

    but when i tried on other device with android sdk version less than 28 ie 27 its working fine with no errors

    In advance Thanks for helping

您必须在清单文件中添加这些行

<uses-library android:name ="org.apache.http.legacy" android:required ="false"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM