2019-03-05 11:29:55.278 9180-9180/com.example.test E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.test, PID: 9180 java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory; at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:182) at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:150) at com.example.test.MainActivity.onCreate(MainActivity.java:49) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 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)
2 回答
holdtom
TA贡献1805条经验 获得超10个赞
在 build.gradle 文件中转到 android 块并使用 apache 库。前任。
android{ useLibrary 'org.apache.http.legacy'}
qq_遁去的一_1
TA贡献1725条经验 获得超7个赞
在AndroidManifest.xml
里面<application>
部分,添加:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
(在我的情况下,在 gradle 中添加 useLibrary 不起作用。)
添加回答
举报
0/150
提交
取消