Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28081] Android: App build fails if it includes an Apache "commons-logging" library

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2020-11-20T15:43:06.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.3.0
ComponentsAndroid
Labelsandroid, build, gradle, library
ReporterJoshua Quick
AssigneeJoshua Quick
Created2020-08-12T01:07:06.000+0000
Updated2020-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:*

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.

Comments

  1. Joshua Quick 2020-08-27

    PR (9.3.x): https://github.com/appcelerator/titanium_mobile/pull/11970
  2. Samir Mohammed 2020-09-28

    FR Passed, Waiting on Jenkins build.
  3. Samir Mohammed 2020-11-20

    *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

JSON Source