Hi,
i am trying to use libtorch Native in Android application following this tutorial. Making Native Android Application that uses PyTorch prebuilt libraries — PyTorch Tutorials 1.9.0+cu102 documentation 3. I have made some modification in order to get it working and now on the Android Studio emulator i am able to print a libtorch tensor in Android.

libtorchEmulator484×1047 52.3 KB

Unfortunately on arm64-v8a the application crashes with the following error
java.lang.UnsatisfiedLinkError: dlopen failed: library "libpytorch_jni_lite.so" not found: needed by /data/data/com.example.testlib/code_cache/.overlay/base.apk/lib/arm64-v8a/libtestlib.so in namespace classloader-namespace
    at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
    at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
    at java.lang.System.loadLibrary(System.java:1664)
    at com.example.testlib.MainActivity.<clinit>(MainActivity.java:14)
    at java.lang.Class.newInstance(Native Method)
    at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
    at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1253)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3659)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3956)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2295)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8443)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

It seems that libtorch_jni_lite.so is not found. Can someone please help me to understand better how to solve?
Thanks