Can the library that I use in the .apk Android application collide with the library that is used in another application?

I linked jets3t with a test application and got logarithms that I had not seen during installation.

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 read that since the shared library is being overwritten. If so, I wonder if this is the result of something I did wrong. If I rewrote, what are the chances that other applications might break? Of course, any correctly created library will be backward compatible .. and I think that the Android mgr package will not replace the package with an older version?

Plus a few definitions? "do not allow an ambiguous class"?

Oh yes .. the test application seems to be working still :)

Thanks. Guess what I need to look at pkg install, load and link lol.

+4
source share
1 answer

I believe that the only way that you actually damage another application on a properly protected device is if you replace .apk, it depends.

It looks like you are installing .apk, which contains classes that duplicate some of the deviceโ€™s platform libraries. New duplicates are ignored. This is not uncommon since there are many highly attractive 'private' features on the platform that do not have โ€œheadersโ€ (sorry, the wrong term, but conveys the idea) in sdk. This makes writing difficult without including stubs to satisfy the compiler (or using reflection to find real classes at runtime). During installation, these stubs are ignored with the warning messages that you see.

This is not necessarily a good practice, but it tends to work as long as the private functions on the device continue to work properly, i.e. may interrupt when updating the OS or when the program is installed on another device, Android People are pretty persistent in that you should not use private functions for this reason.

The error / warning message remaining in the delivery code, which works despite this, is also not a big practice and, unfortunately, is something really endemic to the Android package itself.

+3
source

Source: https://habr.com/ru/post/1338934/


All Articles