Android mupdf java.lang.UnsatisfiedLinkError:dlopen失败:找不到符号“atof” [英] Android mupdf java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "atof"

查看:1446
本文介绍了Android mupdf java.lang.UnsatisfiedLinkError:dlopen失败:找不到符号“atof”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用mupdf在我的Android应用程序中打开一个pdf文件。该应用程序因此错误而崩溃。

I am using mupdf to open a pdf file in my android app.The app crashes with this error.


java.lang.UnsatisfiedLinkError:dlopen failed:找不到符号
atof由libmupdf_java.so引用。 。

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "atof" referenced by "libmupdf_java.so"...

这是我查看pdf文件的java代码。

This is my java code for viewing the pdf file.

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        RelativeLayout layout = (RelativeLayout) findViewById(R.id.main_layout);

        MuPDFCore core = null;
        try {
            core = new MuPDFCore(this,"/storage/emulated/0/Download/Metamorphosis-jackson.pdf");
        } catch (Exception e) {
            e.printStackTrace();
        }
        MuPDFReaderView reader = new MuPDFReaderView(this);
        reader.setAdapter(new MuPDFPageAdapter(this, new FilePicker.FilePickerSupport() {
            @Override
            public void performPickFor(FilePicker filePicker) {

            }
        }, core ));
        layout.addView(reader);
    }
}

代码在此特定行崩溃。

  core = new MuPDFCore(this,"/storage/emulated/0/Download/Metamorphosis-jackson.pdf");

这是错误日志: -

This is the error log:-


07-13 10:40:34.299 7115-7115 / com.androidnewbee.www.shatayushiapp
E / AndroidRuntime:FATAL EXCEPTION:main
流程:com.androidnewbee.www .shatayushiapp,PID:7115
java.lang.UnsatisfiedLinkError:dlopen失败:找不到符号
atof由libmupdf_java.so引用...
在java.lang.Runtime。 loadLibrary(Runtime.java:364)
at java.lang.System.loadLibrary(System.java:526)
at com.artifex.mupdfdemo.MuPDFCore。(MuPDFCore.java:15)
at
com.androidnewbee.www.shatayushiapp.MainActivity.onCreate(MainActivity.java:23)
at android.app.Activity.performCreate(Activity.java:5301)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2291)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2378)
在android.app.ActivityThread.acce ss $ 800(ActivityThread.java:155)
at
android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java) :102)
在android.os.Looper.loop(Looper.java:136)
在android.app.ActivityThread.main(ActivityThread.java:5433)
在java.lang。 reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at
com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(原生方法)

07-13 10:40:34.299 7115-7115/com.androidnewbee.www.shatayushiapp E/AndroidRuntime: FATAL EXCEPTION: main Process: com.androidnewbee.www.shatayushiapp, PID: 7115 java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "atof" referenced by "libmupdf_java.so"... at java.lang.Runtime.loadLibrary(Runtime.java:364) at java.lang.System.loadLibrary(System.java:526) at com.artifex.mupdfdemo.MuPDFCore.(MuPDFCore.java:15) at com.androidnewbee.www.shatayushiapp.MainActivity.onCreate(MainActivity.java:23) at android.app.Activity.performCreate(Activity.java:5301) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2291) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2378) at android.app.ActivityThread.access$800(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5433) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) at dalvik.system.NativeStart.main(Native Method)

另外我想知道如何显示所有pdf列表中的文件,允许用户使用mupdf从文件中进行选择。
我是编程新手,所以欢迎任何帮助或建议。

Also I would like to know how I can display all the pdf files in a list and allow the user to select from the files to view using mupdf. I am new to programming so any help or suggestion is welcome.

推荐答案

谷歌已经移动了一些C标准库函数如atof()从头文件中的内联函数到普通函数。最新的NDK将默认构建.so,它仅与在设备的标准C库(libc.so)中具有atof()功能的最新Android设备兼容。这意味着如果您在具有较旧版本C库的旧设备上运行库,则在加载dll时会出现错误,因为预期的atof()函数将不存在。

Google have moved some of the C standard library functions like atof() from being inline functions in header files to normal functions. The latest NDKs will default to building a .so that is only compatible with the latest Android devices that have the atof() function in the device's standard C library (libc.so). This means if you run a library on an older device that has an older version of the C library, you will get an error loading the dll as the expected atof() function will not exist.

您是否尝试在Application.mk中设置此项:

Have you tried setting this in your Application.mk:

APP_PLATFORM := android-9

这将导致ndk编译器构建与旧版Android兼容的代码。

This will cause the ndk compiler to build code compatible with older Android versions.

您还可以尝试将NDK安装降级到版本10b(此版本在更改之前,其中atof从内联移动到libc的一部分,因此完全避免了问题。)

You can also try downgrading your NDK installation to version 10b (this version predates the change where atof was moved from inline to part of libc so avoids the problem entirely).

这篇关于Android mupdf java.lang.UnsatisfiedLinkError:dlopen失败:找不到符号“atof”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆