Thursday, May 14, 2015

WARNING: linker: could not load library "" from LD_PRELOAD for "sh"; caused by "" is 32-bit instead of 64-bit CANNOT LINK EXECUTABLE: could not load library "" needed by "sh"; caused by "" is 32-bit instead of 64-bit

I have been trying to fix my app to support Samsung S6. It seems Samsung S6 Android 5.0.2 runs in 64 bit. If you are seeing this error it is likely "" is loaded from wrong location.

If you execute this command in shell,
root@zerolte:/ # printenv "LD_PRELOAD"
printenv "LD_PRELOAD"

you likely being loaded from /system/lib. To fix

export LD_PRELOAD = /system/lib64/

Or you can try something like this:

final String extStoreApkPath = ""
final String libPath = (is64bit() ? "/vendor/lib:/system/lib64" : "/vendor/lib:/system/lib");
final String cmd = String.format("LD_LIBRARY_PATH=%s pm install -r -d %s", libPath, extStoreApkPath);

1 comment:

  1. Export? What you mean by «export» -- copy and paste? from system/lib64 to system/lib ???
    Sorry to declare: your «explanation» needs to be explained...Good grief!