[TIMOB-28081] Android: App build fails if it includes an Apache "commons-logging" library
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-11-20T15:43:06.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.3.0 |
Components | Android |
Labels | android, build, gradle, library |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2020-08-12T01:07:06.000+0000 |
Updated | 2020-11-20T15:43:06.000+0000 |
Description
*Summary:*
If an app includes an Apache "commons-logging" library via gradle (or a module that references it via gradle), then it will fail to build.
*Steps to reproduce:*
Add the below "build.gradle" file to project folder:
Create a "Classic" Titanium app project.
Add the below "build.gradle" file to project folder: ./platform/android
Build for Android.
./platform/android/build.gradle
dependencies {
implementation 'commons-logging:commons-logging:1.1.3'
}
*Result:*
The following build failure will occur...
[ERROR] [GRADLE]
[ERROR] [GRADLE] FAILURE: Build failed with an exception.
[ERROR] [GRADLE]
[ERROR] [GRADLE] * What went wrong:
[ERROR] [GRADLE] Execution failed for task ':app:checkDebugDuplicateClasses'.
[ERROR] [GRADLE] > 1 exception was raised by workers:
[ERROR] [GRADLE] java.lang.RuntimeException: Duplicate class org.apache.commons.logging.Log found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.LogConfigurationException found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.LogFactory found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.LogFactory$1 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.LogFactory$2 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.LogFactory$3 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.LogFactory$4 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.LogFactory$5 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.LogFactory$6 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.LogSource found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.AvalonLogger found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.Jdk13LumberjackLogger found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.Jdk14Logger found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.Log4JLogger found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.LogFactoryImpl found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.LogFactoryImpl$1 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.LogFactoryImpl$2 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.LogFactoryImpl$3 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.LogKitLogger found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.NoOpLog found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.ServletContextCleaner found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.SimpleLog found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.SimpleLog$1 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.WeakHashtable found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.WeakHashtable$1 found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.WeakHashtable$Entry found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.WeakHashtable$Referenced found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE] Duplicate class org.apache.commons.logging.impl.WeakHashtable$WeakKey found in modules jetified-commons-logging-1.1.3.jar (commons-logging:commons-logging:1.1.3) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
[ERROR] [GRADLE]
[ERROR] [GRADLE] Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
*Cause:*
Titanium is including its own copy of the commons-logging-1.1.1.jar
as shown below.
https://github.com/appcelerator/titanium_mobile/tree/master/android/titanium/lib
*Solution:*
We should be referencing this library via gradle instead. This will allow gradle's dependency management resolve this for us.
Or we can remove our usage of this JAR.
PR (9.3.x): https://github.com/appcelerator/titanium_mobile/pull/11970
FR Passed, Waiting on Jenkins build.
*Closing ticket*. Fix verified in SDK version
9.3.0.v20201119063936
. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/11970