Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fatal Exception: ... couldn't find "libmmkv.so" #1322

Closed
syncrexor opened this issue Jun 5, 2024 · 15 comments
Closed

[Android] Fatal Exception: ... couldn't find "libmmkv.so" #1322

syncrexor opened this issue Jun 5, 2024 · 15 comments

Comments

@syncrexor
Copy link

Note:

      Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/me.syncrex.goldv2ray-_t3CvjUR709sgfOdr6Xj7w==/base.apk"],nativeLibraryDirectories=[/data/app/me.syncrex.goldv2ray-_t3CvjUR709sgfOdr6Xj7w==/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libmmkv.so"
       at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
       at java.lang.System.loadLibrary(System.java:1657)
       at com.tencent.mmkv.MMKV.doInitialize(MMKV.java:223)
       at com.tencent.mmkv.MMKV.initialize(MMKV.java:205)
       at com.tencent.mmkv.MMKV.initialize(MMKV.java:91)
       at me.syncrex.goldv2ray.AngApplication.onCreate(AngApplication.kt:35)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
       at android.app.ActivityThread.-wrap1()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Devices

GM Note1
Nexus 5X
Redmi Note 8
and ...

The language of MMKV

Kotlin

The version of MMKV

v1.3.4

The platform of MMKV

Android

My Gradle :

plugins {
    id ("com.android.application")
    id ("org.jetbrains.kotlin.android")
    id ("com.google.gms.google-services")
    id ("com.google.firebase.crashlytics")
    id ("com.google.firebase.firebase-perf")
}
android {
    namespace = "me.syncrex.goldv2ray"
    compileSdk = 34
    defaultConfig {
        applicationId = "me.syncrex.goldv2ray"
        minSdk = 21
        targetSdk = 34
        versionCode = 30
        versionName = "30.1.8.23"
        multiDexEnabled = true
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }

    buildTypes {
        getByName("release") {
            signingConfig = signingConfigs.getByName("debug")
        }
        named("release") {
            isMinifyEnabled = false
            isShrinkResources = false
            isZipAlignEnabled = false
        }
        named("debug") {
            isMinifyEnabled = false
            isShrinkResources = false
            isZipAlignEnabled = false
        }
    }

    buildFeatures {
        viewBinding = true
        buildConfig = true
    }

    sourceSets {
        named("main") {
            jniLibs.srcDirs("src/main/jniLibs")
        }
    }

    packaging {
        jniLibs {
            useLegacyPackaging = true
        }
    }

    bundle {
        language {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }

    splits {
        abi {
            isEnable = true
            isUniversalApk = true
        }
    }
}

dependencies {
    implementation (fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar", "*.jar"))))
    implementation ("androidx.constraintlayout:constraintlayout:2.1.4")
    implementation ("androidx.legacy:legacy-support-v4:1.0.0")
    implementation ("androidx.appcompat:appcompat:1.6.1")
    implementation ("com.google.android.material:material:1.12.0")
    implementation ("androidx.cardview:cardview:1.0.0")
    implementation ("androidx.preference:preference-ktx:1.2.1")
    implementation ("androidx.recyclerview:recyclerview:1.3.2")
    implementation ("androidx.fragment:fragment-ktx:1.7.0")
    implementation ("androidx.multidex:multidex:2.0.1")
    implementation ("androidx.viewpager2:viewpager2:1.1.0-rc01")
    implementation ("androidx.activity:activity-ktx:1.9.0")
    implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
    implementation ("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
    implementation ("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
    implementation ("org.jetbrains.kotlin:kotlin-reflect:1.9.23")
    implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")
    implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0")
    implementation ("com.tencent:mmkv-static:1.3.4")
    implementation ("com.google.code.gson:gson:2.10.1")
    implementation ("io.reactivex:rxjava:1.3.8")
    implementation ("io.reactivex:rxandroid:1.2.1")
    implementation ("com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar")
    implementation ("com.github.jorgecastilloprz:fabprogresscircle:1.01@aar")
    implementation ("me.drakeet.support:toastcompat:1.1.0")
    implementation ("com.blacksquircle.ui:editorkit:2.9.0")
    implementation ("com.blacksquircle.ui:language-base:2.9.0")
    implementation ("com.blacksquircle.ui:language-json:2.9.0")
    implementation ("io.github.g00fy2.quickie:quickie-bundled:1.9.0")
    implementation ("com.google.zxing:core:3.5.3")
    implementation ("androidx.work:work-runtime-ktx:2.9.0")
    implementation ("androidx.work:work-multiprocess:2.9.0")
    // Gold V2Ray //////////////////////////////////////////////////////////////////////////////////
    implementation (platform("com.google.firebase:firebase-bom:33.0.0"))
    implementation ("com.google.firebase:firebase-analytics")
    implementation ("com.google.firebase:firebase-crashlytics")
    implementation ("com.google.firebase:firebase-perf")
    implementation ("com.google.firebase:firebase-inappmessaging-display")
    implementation ("com.google.firebase:firebase-messaging:24.0.0")
    implementation ("com.google.firebase:firebase-config")
    implementation ("com.google.android.ump:user-messaging-platform:2.2.0")
    implementation ("com.google.android.gms:play-services-ads:23.1.0")
    implementation ("com.adivery:sdk:4.7.0")
    implementation ("ir.tapsell.plus:tapsell-plus-sdk-android:2.2.4")
    implementation ("com.github.GoodieBag:Pinview:v1.5")
    implementation ("androidx.core:core-splashscreen:1.0.1")
    implementation ("com.codesgood:justifiedtextview:1.1.0")
    implementation ("com.github.ybq:Android-SpinKit:1.4.0")
}

AngApplication.kt :

package me.syncrex.goldv2ray
import android.content.Context
import androidx.multidex.BuildConfig
import androidx.multidex.MultiDexApplication
import androidx.preference.PreferenceManager
import androidx.work.Configuration
import com.tencent.mmkv.MMKV

class AngApplication : MultiDexApplication(), Configuration.Provider {
    companion object {
        lateinit var application: AngApplication
    }

    override fun attachBaseContext(base: Context?) {
        super.attachBaseContext(base)
        application = this
    }

    override fun onCreate() {
        super.onCreate()
        MMKV.initialize(this)
    }

    private fun getWorkManage(): Configuration {
        return Configuration.Builder()
            .setDefaultProcessName("${BuildConfig.APPLICATION_ID}:bg")
            .build()
    }

    override val workManagerConfiguration: Configuration
        get() = getWorkManage()
}
@lingol
Copy link
Collaborator

lingol commented Jun 5, 2024

Check out this issue #1321 for steps to investigate. I don't have access to the devices you listed so it's on your own.

@lingol
Copy link
Collaborator

lingol commented Jun 6, 2024

Specifically this #1321 (comment)_ .

@yuqiaodan
Copy link

yuqiaodan commented Jun 12, 2024

MMKV 1.3.5 Drop armv7 & x86 support. Use version 1.3.4 to resolve this issue
#1321 (comment)

@syncrexor
Copy link
Author

MMKV 1.3.5 Drop armv7 & x86 support. Use version 1.3.4 to resolve this issue #1321 (comment)

I'm using v1.3.4

Specifically this #1321 (comment)_ .

Thank you, but the problem is not solved yet

@lingol
Copy link
Collaborator

lingol commented Jun 14, 2024

Well what are the logs saying when the mmkvdemo doesn't work?

Specifically this #1321 (comment)_ .

Thank you, but the problem is not solved yet

@syncrexor
Copy link
Author

I try to use non-static version: implementation ("com.tencent:mmkv:1.3.4")
and in firebase get this crash:

Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/me.syncrex.goldv2ray--Li7QKkQRWaOUx3IgcZqug==/base.apk"],nativeLibraryDirectories=[/data/app/me.syncrex.goldv2ray--Li7QKkQRWaOUx3IgcZqug==/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libmmkv.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1011) at java.lang.System.loadLibrary(System.java:1657) at com.tencent.mmkv.MMKV.doInitialize(MMKV.java:223) at com.tencent.mmkv.MMKV.initialize(MMKV.java:205) at com.tencent.mmkv.MMKV.initialize(MMKV.java:91) at me.syncrex.goldv2ray.AngApplication.onCreate(AngApplication.kt:35) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740) at android.app.ActivityThread.-wrap1() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

@lingol
Copy link
Collaborator

lingol commented Jun 18, 2024

No, you are not listening. What are the logs when the mmkvdemo doesn't work?

@syncrexor
Copy link
Author

No, you are not listening. What are the logs when the mmkvdemo doesn't work?

I am sorry ,
I do not have access to the devices that have the error , these are firebase reports .
I run the demo and my app on all my devices without any problems , the main problem occurs on some devices that I don't have access to write the log for you here .
I get about 30 crash per day on this .

@lingol
Copy link
Collaborator

lingol commented Jun 18, 2024

Anyway have you tried using the ReLinker which the FAQ suggested?

@lingol
Copy link
Collaborator

lingol commented Jun 18, 2024

@syncrexor
Copy link
Author

https://github.com/Tencent/MMKV/wiki/FAQ_cn

I have released a new version with ReLinker and have not received any errors so far.
It seems that the problem is solved by using ReLinker.
Thank you.

@lingol lingol closed this as completed Jun 22, 2024
@syncrexor
Copy link
Author

Unfortunately, another error was reported with ReLinker today :
Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/me.syncrex.goldv2ray-mYgjl6CKiWwm7ArbPR3E5A==/base.apk"],nativeLibraryDirectories=[/data/app/me.syncrex.goldv2ray-mYgjl6CKiWwm7ArbPR3E5A==/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libmmkv.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1011) at java.lang.System.loadLibrary(System.java:1657) at com.tencent.mmkv.MMKV.doInitialize(MMKV.java:223) at com.tencent.mmkv.MMKV.initialize(MMKV.java:205) at com.tencent.mmkv.MMKV.initialize(MMKV.java:91) at me.syncrex.goldv2ray.AngApplication.onCreate(AngApplication.kt:23) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740) at android.app.ActivityThread.-wrap1() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

@lingol
Copy link
Collaborator

lingol commented Jun 23, 2024

That doesn't look like a ReLinker call stack to me. Are you sure it is used?

@syncrexor
Copy link
Author

That doesn't look like a ReLinker call stack to me. Are you sure it is used?

in my Kotlin app I'm using ReLinker by this way :

val rootDir = MMKV.initialize(this) MMKV.initialize(rootDir, object : MMKV.LibLoader { override fun loadLibrary(libName: String?) { ReLinker.loadLibrary(application, libName) } })
is it right?

@lingol
Copy link
Collaborator

lingol commented Jun 23, 2024

No, it's wrong. It will crash in the first line.
You should calculate the root direction of mmkv by yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants