0

I have a libfoo.so library which I used it for architecture armeabi for my old Android system. Today I am building to new architecture arm64-v8a, I have configured correctly in gradle abiFilters += 'arm64-v8a', and I unzip my apk, I can find my libfoo.so library in myApp.apk/lib/arm64-v8a. I don't have source code for this libfoo.so library, so I used back previous one which is built for armeabi. But I got the error as below:

2020-11-17 20:56:23.039 13083-13556/? W/System.err: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/sg.com.aa.bb-1/base.apk"],nativeLibraryDirectories=[/data/app/sg.com.aa.bb-1/lib/arm64, /data/app/sg.com.aa.bb-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libfoo.so"

As you can see this path /data/app/sg.com.aa.bb-1/base.apk!/lib/arm64-v8a, I am pretty sure my libfoo.so file is inside, but why it keep saying couldn't find libfoo.so?

I run file command on the file libfoo.so, it shows:

ELF 32-bit LSB pie executable ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/, stripped

There are people asked similar question before, arm64-v8a should be compatible with those 32 bit library, like this. And this, it says 64-bit devices also support their 32-bit variants. Using arm64-v8a devices as an example, the device can also run armeabi and armeabi-v7a code. Note, however, that your application will perform much better on 64-bit devices if it targets arm64-v8a rather than relying on the device running the armeabi-v7a version of your application.

In this case, could it be other possibilities that cause the UnsatisfiedLinkError above?


Conclusion:

I finally got what @Jake mean, I am kind of confused with what so-called "arm64-v8a support 32 bit too". Yes, it does support but provided it runs in 64 bit mode, and once an Android app start in 64 bit mode, it can't execute any 32 bit C library. So I have to find a way to force the app to run in 32 bit mode.

Sam YC
  • 10,725
  • 19
  • 102
  • 158

1 Answers1

0
  • Some armv8-a cores don't have aarch32 mode.
  • aarch32 functions can only be called on OS operating in aarch32 mode.
  • You cannot mix aarch32 binaries with aarch64 ones.
  • An architecture isn't an ABI
  • aarch32 binaries only run on 32bit abi.
Jake 'Alquimista' LEE
  • 6,197
  • 2
  • 17
  • 25