java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory

本小妞迷上赌 提交于 2019-12-03 05:20:34

This is an AWS SDK bug that appears to be solved in version 2.6.30 of the SDK:

Fixed a bug where getting a logger using Apache Commons Logging would crash starting Android 9.0 (Pie / API Level 28). See pull #521. Now, Apache Commons Logging would be used if it's being added as a dependency, otherwise android.util.Log will be used.

Add this below line in menifest file.

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

to fix this issue I had the dependency implementation "commons-logging:commons-logging-api:1.1" in gradle file.

An alternative workaround is to add the commons-logging library as a .jar file to your libs/ folder instead of using implementation. Make sure that implementation fileTree(include: ['*.jar'], dir: 'libs') is in your dependencies.

Sources of commons-logging-1.2.jar:

  1. Maven Repository
  2. Apache Commons Logging

Credit: Dale Lim - https://github.com/aws/aws-sdk-android/issues/265#issuecomment-411978696

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!