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

后端 未结 5 1675
北海茫月
北海茫月 2021-02-04 01:31

Similar questions have need asked already. But this one seems to be more complicated than previous ones because of changes in compatibility of Android Platforms.

Here is

相关标签:
5条回答
  • 2021-02-04 01:39
       /*Apache Commons Logging would crash starting Android 9.0 (Pie / API Level 28).*/
    
       //try this 
    
        testImplementation 'commons-logging:commons-logging:1.2'
    
        // in manifest  <application> s
        <uses-library android:name="org.apache.http.legacy" android:required="false" />
    
         /* if this files  'commons-logging:commons-logging:1.2' fails to download  then
          download this file manual  from http://commons.apache.org/proper/commons- 
           logging/download_logging.cgi and paste it lib folder*/
    
    0 讨论(0)
  • 2021-02-04 01:46

    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

    0 讨论(0)
  • 2021-02-04 01:50

    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.

    0 讨论(0)
  • 2021-02-04 01:53

    Add this below line in manifest file.

    <uses-library android:name ="org.apache.http.legacy" android:required ="false"/>
    
    0 讨论(0)
  • 2021-02-04 02:02

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

    0 讨论(0)
提交回复
热议问题