Hi @guangy10,
following i am reporting what i have changed. Basically I refactor the example with a more simpler one and update the library with libtorch 1.9.0.
CMakeLists.txt
cmake_minimum_required(VERSION 3.10.2)
project("testlib")
set(LIB_TR /media/aistudios/44c62318-a7de-4fb6-a3e2-01aba49489c5/Develop/Official/DockerContainer/Android/Develop/testLib/pytorch_android_lite-1.9.0.aar)


#link_directories(${LIB_TR})

add_library( 
        testlib
        SHARED
        native-lib.cpp)


add_library( imported-pytorch
        SHARED
        IMPORTED )

set_target_properties( 
        imported-pytorch
        PROPERTIES IMPORTED_LOCATION
        ${LIB_TR}/jni/${ANDROID_ABI}/libpytorch_jni_lite.so )


add_library( imported-jni
        SHARED
        IMPORTED )

set_target_properties( # Specifies the target library.
        imported-jni  
        PROPERTIES IMPORTED_LOCATION
        ${LIB_TR}/jni/${ANDROID_ABI}/libfbjni.so )

find_library( # Sets the name of the path variable.
        log-lib
        log)


target_include_directories(testlib PUBLIC ${LIB_TR}/headers )

target_link_libraries( 
        testlib
        imported-pytorch
        # Links the target library to the log library
        # included in the NDK.
        ${log-lib})

build.gradle
plugins {
    id 'com.android.application'
}

android {
    compileSdk 30
//    configurations {
//        extractForNativeBuild
//    }
    defaultConfig {
        applicationId "com.example.testlib"
        minSdk 28
        targetSdk 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cppFlags '-std=c++17'

            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    externalNativeBuild {
        cmake {
            path file('src/main/cpp/CMakeLists.txt')
            version '3.10.2'
        }
    }
    buildFeatures {
        viewBinding true
    }


}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    implementation 'org.pytorch:pytorch_android_lite:1.9.0'
//    extractForNativeBuild 'org.pytorch:pytorch_android_lite:1.9.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

native-lib.cpp
#include <jni.h>
#include <string>
#include <torch/script.h>

extern "C" JNIEXPORT jstring JNICALL
Java_com_example_testlib_MainActivity_stringFromJNI(
        JNIEnv* env,
        jobject /* this */) {
    std::string hello = "Hello from C++";
    torch::Tensor x = torch::randn({4, 8});
    std::ostringstream stream;
    stream << x;
    std::string tensor_string = stream.str();
    return env->NewStringUTF(tensor_string.c_str());
}

As i reported this code is working on x86 but it is crashing on arm64-v8a device. I have followed the tutorial to extract libtorch_jni_lite.so from the aar archive.
If you have any idea on how i can fix this, please let me know. Thanks