Android版的System.loadLibrary摊位加载本地库 [英] Android System.loadLibrary stalls while loading native library

查看:305
本文介绍了Android版的System.loadLibrary摊位加载本地库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当大的共享库文件(= 12megabytes)不包含任何JNI code任何责任。

I have a rather large shared library file (= 12megabytes) which does not contain any JNI code whatsoever.

致电时的System.loadLibrary(SOME_FILE)方法的从不返回并不会产生相关的输出。此外,Windows任务管理器报告该仿真器实例未占用所有的CPU资源。

When calling System.loadLibrary("some_file") the method never returns and no relevant output is generated. Also, Windows Taskmanager reports that the emulator instance is not hogging all the CPU power.

我有以下code类:

static 
{
    System.out.println("Trying");
    System.loadLibrary("some_file");
    System.out.println("Works");
}

下面是从LogCat中给出的输出:

Here is the output given from LogCat:

I/System.out(534): Trying
D/dalvikvm(534): Trying to load lib /data/data/app/lib/libsome_file.so 0x40643c20

如果我上传使用该库libsome_file.so本地测试应用程序和模拟器shell中运行这一点,那么应用程序的工作。

If I upload a native test application that uses the library libsome_file.so and run this from the emulator shell, then the application works.

有没有进行调试的System.loadLibrary正在做或任何人都不会有一些提示,为什么的System.loadLibrary一去不复返?法

Is there any method to debug what System.loadLibrary is doing or does anyone have some hints why System.loadLibrary might never return?

推荐答案

我找到了解决自己的问题。我没有使用任何额外的调试工具,但离开了库加载时所运行一些code。具体code绞刑,使得悬挂的System.loadLibrary以及

I found the solution to the problem myself. I did not use any additional debug tools, but left out some code that was run when the library loaded. The particular code hanged, making System.loadLibrary hang as well.

这篇关于Android版的System.loadLibrary摊位加载本地库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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