I have this service:

class ImageProcessingService : Service() {

    val myRealm = Realm.open(
        configuration = RealmConfiguration.create(
            schema = setOf(
                RealMImageLabel::class
            )
        ),
    )

    val repository = ImageRepository(this, myRealm)
    private val serviceScope = CoroutineScope(Dispatchers.IO + SupervisorJob())
    override fun onCreate() {
        super.onCreate()

    }

    override fun onDestroy() {
        super.onDestroy()
        serviceScope.cancel()
    }

    override fun onBind(intent: Intent?): IBinder? {
        return null
    }

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        startForegroundService()
        startProcessingImages()
        return START_STICKY
    }

    private fun startForegroundService() {


        val notification: Notification =
            NotificationCompat.Builder(this, ImageProcessingNotification.channel_id)
                .setContentTitle("Processing Images")
                .setContentText("Image processing is running in the background")
                .setSmallIcon(R.drawable.ic_notification)
                .build()

        startForeground(1, notification)
    }

    private fun startProcessingImages() {
        serviceScope.launch {
            try {
                withContext(Dispatchers.IO) {
                    processImages()

                }
            } catch (e: Exception) {
                // Handle exceptions
                Log.wtf("ImageProcessingService", "Error processing images", e)
            }
        }
    }

    private suspend fun processImages() = coroutineScope {
        // Fetch all images
        var time: Duration? = null
        val allImages = repository.allImages.first()
        val processedIds =
            repository.processedImages.map { it.map { imageLabel -> imageLabel.imageId } }.first()
        val unprocessedImages = allImages.filter { it.id !in processedIds }
        val MLLabelGenerator = ImageLabeling.getClient(ImageLabelerOptions.DEFAULT_OPTIONS)
        val TextRecognizer = TextRecognition.getClient(TextRecognizerOptions.DEFAULT_OPTIONS)

        // Set concurrency level and dispatcher
        val concurrencyLevel = 8 // Adjust based on device capabilities
        val dispatcher = Dispatchers.IO.limitedParallelism(concurrencyLevel)


        unprocessedImages.chunked(50).forEach { batch ->
            time = measureTime {
                val deferredResults = batch.map { media ->
                    async(dispatcher) {
                        val inputImage = media.toInputImage(this@ImageProcessingService)
                            ?: return@async null

                        // Use the await() extension functions from kotlinx-coroutines-play-services
                        val labelsDeferred = async { MLLabelGenerator.getLabels(inputImage) }
                        val textDeferred = async { TextRecognizer.getText(inputImage) }
                        ImageLabel(
                            media.id,
                            media.uri.toString(),
                            media.time,
                            labelsDeferred.await(),
                            textDeferred.await()
                        )
                    }
                }

                val imageLabels = deferredResults.awaitAll().filterNotNull()
                imageLabels.flowMapNotNull { imageLabel ->
                    repository.addProcessedImage(imageLabel)
                }
            }
        }

        Log.wtf("ImageProcessingService", "Processing of ${unprocessedImages.size} took $time")
        stopSelf()
    }

    companion object {
        init {
            System.loadLibrary("realm-jni") // Load Realm's native library

        }
    }
}

// Adjusted suspend functions using kotlinx-coroutines-play-services
suspend fun TextRecognizer.getText(inputImage: InputImage): List<String> {
    val result = this.process(inputImage).await()
    return result.textBlocks.flatMap { it.lines.flatMap { line -> line.elements.map { it.text } } }
}

suspend fun ImageLabeler.getLabels(inputImage: InputImage): List<String> {
    val labels = this.process(inputImage).await()
    return labels.map { it.text }
}




but I get this error :
Process: com.codeslu.detector:image_processing, PID: 10937
                                                                                                    java.lang.UnsatisfiedLinkError: dlopen failed: library "librealm-jni.so" not found

Knowing that the service runs in a separate process how do I fix it 
my app build.gradle file:
plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.jetbrains.kotlin.android)
    id("kotlin-kapt")
    id("com.google.dagger.hilt.android")
    id("io.realm.kotlin")
}

android {
    namespace = "com.codeslu.detector"
    compileSdk = 34

    defaultConfig {
        applicationId = "com.codeslu.detector"
        minSdk = 24
        targetSdk = 34
        multiDexEnabled = true
        versionCode = 1
        versionName = "1.0"
        ndk {
            abiFilters.addAll(listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64"))
        }
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary = true
        }
    }
    signingConfigs {
        create("release") {
            keyAlias = "key0"
            keyPassword = "123456"
            storeFile = file("D:\\Ahmed\\Keystores\\detector\\detector.jks")
            storePassword = "123456"
        }
    }
    buildTypes {
        release {
            isMinifyEnabled = true
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
            signingConfig = signingConfigs.getByName("release")
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    buildFeatures {
        compose = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.5.1"
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }
}

dependencies {
    val voyagerVersion = "1.1.0-beta02"


    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activity.compose)
    implementation(platform(libs.androidx.compose.bom))
    implementation(libs.androidx.ui)
    implementation(libs.androidx.ui.graphics)
    implementation(libs.androidx.ui.tooling.preview)
    implementation(libs.androidx.material3)
    implementation("com.google.mlkit:image-labeling:17.0.9")
    implementation("com.markodevcic:peko:3.0.5")
    // Navigator
    implementation("cafe.adriel.voyager:voyager-navigator:$voyagerVersion")
    // Screen Model
    implementation("cafe.adriel.voyager:voyager-screenmodel:$voyagerVersion")
    //OCR
    implementation("com.google.mlkit:text-recognition:16.0.1")
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    androidTestImplementation(platform(libs.androidx.compose.bom))
    androidTestImplementation(libs.androidx.ui.test.junit4)
    debugImplementation(libs.androidx.ui.tooling)
    debugImplementation(libs.androidx.ui.test.manifest)
    //Hilt
    implementation("com.google.dagger:hilt-android:2.51.1")
    kapt("com.google.dagger:hilt-android-compiler:2.51.1")
    implementation("cafe.adriel.voyager:voyager-hilt:$voyagerVersion")
    implementation("io.realm.kotlin:library-base:1.16.0")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0")
    //coil
    implementation("io.coil-kt:coil-compose:2.7.0")
    //Gpt-layer
    implementation(project(":GPT-Layer"))
    //Jackson
    implementation(libs.jackson.module.kotlin)
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.0")


}
kapt {
    correctErrorTypes = true
}