I have observed a strange behaviour that I can't explain. The only explanation I see is that android uses classes not listed in the android.jar . I have the following problem:
I have existing source files (+100) that use commons-logging. They obtain the Log by calling LogFactory.getLog(class)
I want to see the Log output but can't - so I want to redirect the output to logcat.
Therefor I've written a simple implementation of the org.commons.logging.Log Interface that calls the android.util.Log class.
now i had to make sure that LogFactory.getLog(class) returns that implementation. So I deleted(!) the LogFactory.class from the commons-logging.jar and added its source so I could modify it. I changed the method getLog() so that it returns my wrapper class.
I thought that would do the job, but when I install the apk I get:
11-25 11:43:07.386: DEBUG/dalvikvm(224): DexOpt: 'Lorg/apache/commons/logging/LogFactory;' has an earlier definition; blocking out
11-25 11:43:07.374: DEBUG/dalvikvm(224): DexOpt: 'Lorg/apache/commons/logging/LogConfigurationException;' has an earlier definition; blocking out
11-25 11:43:07.394: DEBUG/dalvikvm(224): DexOpt: 'Lorg/apache/commons/logging/impl/Jdk14Logger;' has an earlier definition; blocking out
(and so on)
I looked into my sources, I searched my libs and turned to the android.jar - but I didn't find more than one definition each. I allso stared the emulator with -wipe-data and cleaned the bin directory before build. No effect.
So all I can conclude is that andorid contains a hidden implementation of commons-logging.
does that sound reasonable, or is there something i could have forgotten to check?