"java.lang.UnsatisfiedLinkError... Solutions to have text relocations

Problems encountered

A few days ago, when doing the function of sweeping, we used zxing. The following reaction occurred on Android 6.0 system:

Process: com.mhealth37.BloodPressure, PID: 21082

    java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/com.mhealth37.BloodPressure-1/lib/arm/libiconv.so: has text relocations

    at java.lang.Runtime.loadLibrary(Runtime.java:384)

    at java.lang.System.loadLibrary(System.java:1086)

    at com.mhealth37.butler.bloodpressure.activity.CameraScanActivity.<clinit>(CameraScanActivity.java:65)

    at java.lang.Class.newInstance(Native Method)

    at android.app.Instrumentation.newActivity(Instrumentation.java:1070)

    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2342)

    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504)

    at android.app.ActivityThread.access$900(ActivityThread.java:165)

    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)

    at android.os.Handler.dispatchMessage(Handler.java:102)

    at android.os.Looper.loop(Looper.java:150)

    at android.app.ActivityThread.main(ActivityThread.java:5546)

    at java.lang.reflect.Method.invoke(Native Method)

    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682)

Solution

As today's domestic mobile ROM s are gradually upgraded to Android 6.0 system, I believe that many developers will encounter such problems. Today I share a solution. In fact, it is very simple. This libiconv.so (xx.so) file uses a lower version of SDK. At that time, my targetSdkVersion was 23, so I reduced it to 22, so I can no longer report errors, and can. Enough normal use. This is the solution to the libiconv. so file. If the xx. so file you use is reduced to 22 and an error is reported, it is recommended that you continue to try to reduce the version.

Example:

compileSdkVersion 23
    buildToolsVersion '23.0.3'
    defaultConfig {
        applicationId "com.loonggg.xxxx.xxxx"
        minSdkVersion 11
        targetSdkVersion 22
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        versionCode 55
        versionName "5.2.4"

        // dex breaks through the limit of 65535
        multiDexEnabled true
        // The default is umeng's channel
        manifestPlaceholders = [UMENG_CHANNEL_VALUE: "loonggg"]
    }

Tags: Java Android libiconv Attribute

Posted on Thu, 14 Feb 2019 19:51:18 -0800 by NewfieBilko