3

I have been getting sporadic, difficult to reproduce UnsatisfiedLinkErrors, most commonly when my application has been paused for a long time (i.e., hours). These errors occur on JNI calls that normally work.

Does Android sometimes unload a library without completely closing an application? I load my native library in one activity but also use it in another activity. Could Android be destroying the activity that loaded the library and unloading it, then failing to reload the library when the other activity that uses it is resumed?

4

1 回答 1

1

每次您使用这样的 Activity 加载库时,

   static {
        System.loadLibrary("gamescript");
    }       

然后库像本地静态成员一样在 Activity 类中加载,并且在应用程序处于活动状态之前不会被卸载。但是,我怀疑它是否可以从课堂外访问。

于 2012-05-18T03:55:11.233 回答