Load 2 files .so native lib from 2 different projects in android -


i have 2 projects , b. both of them using native code.

now, set java library.

then, add library b.

when run b, project b can not load native lib in b.

please give me instruction!

i assume "when run b, project b can not load native lib in b.", mean "when run b, project b can not load native lib in a.". this

1) copy files in project asset folder
2) have class in project load libraries. (some static function)
3) in libraries init function of a, copy them system folder , load library.

below code example:

public static void copyfilestream(inputstream src, outputstream dst)   {     try {         byte[] buffer = new byte[4096];         int bytesread;          while ((bytesread = src.read(buffer)) != -1)             dst.write(buffer, 0, bytesread);     }catch(ioexception e) {         e.printstacktrace();     } }  public static int loadlibraries() {     assetmanager assetmanager = mycontext.getassets();     inputstream verlibin = null;     outputstream verlibout = null;        verlibin = assetmanager.open("liblibrary.so");     verlibout = mycontext.openfileoutput(mycontext.getfilesdir().getabsolutepath() + "/" + "liblibrary.so", context.mode_private);     copyfilestream(verlibin, verlibout);     verlibin.close();     verlibout.close();      system.load(mycontext.getfilesdir().getabsolutepath() + "/" + "liblibrary.so"); } 

above code written logic purpose. optimize same use.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -