Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28081

Android: App build fails if it includes an Apache "commons-logging" library

    Details

    • Story Points:
      3
    • Sprint:
      2020 Sprint 19

      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:

      1. Create a "Classic" Titanium app project.
      2. Add the below "build.gradle" file to project folder: ./platform/android
      3. 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.

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Samir Mohammed
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration