These days to do the project encountered a problem, a total of 17M apk, only two. So files accounted for 14M, just try to install the user after the app, according to the user needs to load. So files, after the search, the method is not complicated.
1. The network download portion of the. So file is not displayed,
2.. so file storage path: General recommendations are stored under the data/data/<packagename>/path with the following code:
//Getfiledir ():/data/data/<packagename>/file/File file2 =NewFile (Getfilesdir (), "libbankeyscoreapi.so"); Try { //fos = openfileoutput ("libbankeyscoreapi.so", context.mode_private);//The first parameter: file name, do not allow to include delimiter "/", if the file does not exist, Android will automatically create//second parameter: Specify the mode of operation
It is recommended to use this, but after the test will be saved, the hint "/data/data/<packagename>/app_" is a path error
I'm giving up on this way
FOS =NewFileOutputStream (File2.getabsolutefile ()); Fos.write (b); Fos.close (); LOG.E ("TAG", "" "+true+ ";" +File2.getabsolutepath ()); } Catch(FileNotFoundException e) {e.printstacktrace (); LOG.E ("TAG", E.getmessage ()); } Catch(IOException e) {e.printstacktrace (); LOG.E ("TAG", E.getmessage ()); } System.load (File2.getabsolutepath ());
In addition: Lib Lower library will generally be backed up under/data/data/<packagename>/lib/, call method to make a change, as follows:
System.loadlibrary ("");
Also, attach:
Getpackagecodepath ():/data/app/com.example.download.sotest-2.apk
Getfilesdir ():/data/data/com.example.download.sotest/files
Getpackageresourcepath ():/data/app/com.example.download.sotest-2.apk
Getcachedir ():/data/data/com.example.download.sotest/cache
Getexternalcachedir ():/storage/emulated/0/android/data/com.example.download.sotest/cache
Getobbdir ():/storage/emulated/0/android/obb/com.example.download.sotest
Getfilesdir ():/data/data/com.example.download.sotest/files
The above part I tried after is feasible, hoped can help everybody.
Android Network Load Dynamic Library.