1

This question and this post mention that the NDK builds with armeabi-v7a ABI filters would work for aarch64 Android platforms as well, so we don't need to include arm64-v8a in the ABI filters list.

However, I faced the following problem on two aarch64 platforms, a Lenovo Phab-P1770M and a Redmi 3S.

I am using opencv library in my project. However, when I add the following to my app.module

ndk {
        abiFilters "armeabi-v7a", "x86"
    }

I see that the built apk does not include libopencv_java3.so in the lib/armeabi-v7a and lib/x86 folders. Calling opencv functions, obviously crashes as well with the error, libopencv_java3.so.

However, when I add arm64-v8a to the list above, lib/arm64-v8a folder is additionally created in the APK as well ( as expected). But the libopencv_java3.so library is present only in that directory and as expected, the module gets loaded properly on runtime.

So basically, I want to understand whether just using the ABI filter armeabi-v7a work for aarch64 platform as well or not. Because the aforementioned two posts say that it should, but my experience does not show that.

Can anyone help me understand what am I doing wrong?

Rajan Prasad
  • 1,582
  • 1
  • 16
  • 33

1 Answers1

0

armeabi-v7a is 32-bit CUP architecture, usually it is compatible with 64-bit architecture as well. If you don't provide the proper dynamic library, i.e. the corresponding arm64-v8a, Installation manager will pick up the secondary ABI, i.e. the armeabi-v7a for your target phone.

But, why not always use the primary ABI for your app? As the primary ABI will give your app best performance.

You can get more details about abi from here: https://developer.android.com/ndk/guides/abis

shizhen
  • 12,251
  • 9
  • 52
  • 88