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
/*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*/
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
:
Credit: Dale Lim - https://github.com/aws/aws-sdk-android/issues/265#issuecomment-411978696
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 manifest 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.