Uploaded image for project: 'Spring for Android'
  1. Spring for Android
  2. ANDROID-14

Warnings about ambiguous class definitions when including commons-logging in an Android project

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Works as Designed
    • Affects Version/s: 1.0.0.M1
    • Fix Version/s: 1.0.0.M2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Android

      Description

      Including the spring-android-commons-logging jar in an Android project generates many log file entries about ambiguous class definitions when you run the app.

      From the Android log:

      12-07 18:11:22.539: DEBUG/dalvikvm(495): DexOpt: 'Lorg/apache/commons/logging/Log;' has an earlier definition; blocking out
      12-07 18:11:22.539: DEBUG/dalvikvm(495): DexOpt: 'Lorg/apache/commons/logging/LogConfigurationException;' has an earlier definition; blocking out
      12-07 18:11:22.549: DEBUG/dalvikvm(495): DexOpt: 'Lorg/apache/commons/logging/LogFactory;' has an earlier definition; blocking out
      12-07 18:11:22.850: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.870: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.870: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.870: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.880: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.900: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.900: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.900: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.910: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.910: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.910: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:22.980: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'
      12-07 18:11:22.990: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'
      12-07 18:11:22.990: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.010: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.010: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.020: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.020: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.039: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.039: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.039: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.069: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.069: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.069: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.079: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'
      12-07 18:11:23.089: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'
      12-07 18:11:23.100: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'
      12-07 18:11:23.100: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'
      12-07 18:11:23.119: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'
      12-07 18:11:23.119: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.129: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.139: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.139: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.139: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.139: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.149: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.149: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.159: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.169: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.169: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.179: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.179: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.189: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.229: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.229: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.229: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.229: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:23.259: DEBUG/dalvikvm(495): DexOpt: not verifying 'Lorg/apache/commons/logging/Log;': multiple definitions
      12-07 18:11:23.269: DEBUG/dalvikvm(495): DexOpt: not verifying 'Lorg/apache/commons/logging/LogConfigurationException;': multiple definitions
      12-07 18:11:23.269: DEBUG/dalvikvm(495): DexOpt: not verifying 'Lorg/apache/commons/logging/LogFactory;': multiple definitions
      12-07 18:11:23.279: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:24.229: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:24.229: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:24.329: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
      12-07 18:11:24.329: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'
      12-07 18:11:24.329: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'
      12-07 18:11:24.349: INFO/dalvikvm(495): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/Log;'

        Activity

        Hide
        rclarkson Roy Clarkson added a comment -

        Looking at the Android Reference, org.apache.commons.logging.Log is not defined as being part of the Android package. However viewing the contents of the Anroid 1.5 jar file, shows the Log.class to be present. I've confirmed it's inclusion in later versions of the Android API as well. spring-android-commons-logging includes this class, which is likely the cause of the "ambiguous class" log entries.

        Show
        rclarkson Roy Clarkson added a comment - Looking at the Android Reference, org.apache.commons.logging.Log is not defined as being part of the Android package. However viewing the contents of the Anroid 1.5 jar file, shows the Log.class to be present. I've confirmed it's inclusion in later versions of the Android API as well. spring-android-commons-logging includes this class, which is likely the cause of the "ambiguous class" log entries.
        Hide
        rclarkson Roy Clarkson added a comment -

        More testing has shown the commons logging classes are all present in Android, but are not available for compiling against. Including any implementation of these classes results in the ambiguous class warnings.

        Show
        rclarkson Roy Clarkson added a comment - More testing has shown the commons logging classes are all present in Android, but are not available for compiling against. Including any implementation of these classes results in the ambiguous class warnings.
        Hide
        rclarkson Roy Clarkson added a comment -

        Android includes a private implementation of Commons Logging. As of the M2 release, spring-android-commons-logging has been removed from distribution build for reevaluation.

        Show
        rclarkson Roy Clarkson added a comment - Android includes a private implementation of Commons Logging. As of the M2 release, spring-android-commons-logging has been removed from distribution build for reevaluation.

          People

          • Assignee:
            rclarkson Roy Clarkson
            Reporter:
            rclarkson Roy Clarkson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: