简体   繁体   English

Android上共享库的实例

[英]Instances of shared library on android

There is a shared library with static variables and functions I want to use in both Flex and Java. 我想在Flex和Java中都有一个包含静态变量和函数的共享库。 So my Flex application loads the library through an ANE file, the Java through JNI (though it is the exact same library). 因此,我的Flex应用程序通过ANE文件加载库,通过JNI加载Java库(尽管它是完全相同的库)。 Does Android load 2 instances of the library for each application or does it use the same instance for every app using it? Android是否为每个应用程序加载2个该库的实例,还是为每个使用该库的应用程序使用相同的实例?

For example: The library has a static integer variable that is assigned to 0 when created. 例如:库具有一个静态整数变量,该变量在创建时将分配为0。 Flex changed that integer to a 3. What result will Java give if the Java code reads that variable. Flex将该整数更改为3。如果Java代码读取该变量,Java将给出什么结果。 A 0 or the 3? 0还是3?

So technically they are two different applications 所以从技术上讲,它们是两种不同的应用

If they are two different applications (eg, would have two separate entries in the Play Store), then they will run in separate processes. 如果它们是两个不同的应用程序(例如,在Play商店中有两个单独的条目),则它们将在单独的进程中运行。 Each app will have a copy of the JNI code; 每个应用程序都有一个JNI代码的副本; each process will load its own copy of that JNI code. 每个进程将加载自己的该JNI代码副本。 Nothing will be shared between them, any more than if the two applications were installed on separate devices. 它们之间不会共享任何东西,就像将两个应用程序安装在单独的设备上一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM