Tuesday, February 8, 2011

Can a library I use in my Android app .apk collide with that library used in another app?

Programmer Question

I linked jets3t into a test app and got logcats I've not yet seen during install ..



02-08 12:21:11.825: DEBUG/PackageParser(1086): Scanning package: /data/app/vmdl28891.tmp
02-08 12:21:12.059: DEBUG/PackageManager(1086): Scanning package org.jets3t
02-08 12:21:12.075: INFO/PackageManager(1086): /data/app/org.jets3t-1.apk changed; unpacking
02-08 12:21:12.082: DEBUG/installd(1009): DexInv: --- BEGIN '/data/app/org.jets3t-1.apk' ---
02-08 12:21:12.481: DEBUG/dalvikvm(26867): creating instr width table
02-08 12:21:12.715: DEBUG/dalvikvm(26867): DexOpt: 'Lorg/apache/commons/codec/Decoder;' has an earlier definition; blocking out
02-08 12:21:12.715: DEBUG/dalvikvm(26867): DexOpt: 'Lorg/apache/commons/codec/BinaryDecoder;' has an earlier definition; blocking out
02-08 12:21:12.715: DEBUG/dalvikvm(26867): DexOpt: 'Lorg/apache/commons/codec/Encoder;' has an earlier definition; blocking out
02-08 12:21:12.715: DEBUG/dalvikvm(26867): DexOpt: 'Lorg/apache/commons/codec/BinaryEncoder;' has an earlier definition; blocking out
... many more ...
'Lorg/apache/commons/logging/impl/WeakHashtable$Entry;': multiple definitions
02-08 12:21:12.973: DEBUG/dalvikvm(26867): DexOpt: not verifying 'Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;': multiple definitions
02-08 12:21:12.973: DEBUG/dalvikvm(26867): DexOpt: not verifying 'Lorg/apache/commons/logging/impl/WeakHashtable$WeakKey;': multiple definitions
02-08 12:21:12.973: DEBUG/dalvikvm(26867): DexOpt: not verifying 'Lorg/apache/commons/logging/impl/WeakHashtable;': multiple definitions
02-08 12:21:13.168: INFO/dalvikvm(26867): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
... many more ...
02-08 12:21:13.364: INFO/dalvikvm(26867): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/logging/LogFactory;'
02-08 12:21:13.387: DEBUG/libgps(1086): GpsInterface_inject_location( 37.378289, -122.059655, 897.000 )
02-08 12:21:13.387: DEBUG/dalvikvm(26867): DexOpt: load 111ms, verify 540ms, opt 21ms
02-08 12:21:13.543: DEBUG/installd(1009): DexInv: --- END '/data/app/org.jets3t-1.apk' (success) ---
02-08 12:21:13.551: INFO/ActivityManager(1086): Force stopping package org.jets3t uid=10084
02-08 12:21:13.559: DEBUG/PackageManager(1086): Activities: org.jets3t.MainActivity
02-08 12:21:13.832: INFO/installd(1009): move /data/dalvik-cache/data@app@org.jets3t-1.apk@classes.dex -> /data/dalvik-cache/data@app@org.jets3t-1.apk@classes.dex
02-08 12:21:13.832: DEBUG/PackageManager(1086): New package installed in /data/app/org.jets3t-1.apk


I'm reading that as shared library overwrites. If it is, I'm wondering if this is a result of something I did wrong? If I overwrite, what are the chances that other apps could break? Of course any properly created library will be backward compatible .. and I guess Android package mgr would not replace a package with an older variant?



Plus "multiple definitions"? "not resolving ambiguous class"?



Oh yeah.. the test app seems to work fine so far :)



Thanks. Guess I need to go read up on pkg install, load, and link lol.



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails