Android: Can write to lib dir?

后端 未结 2 589
一整个雨季
一整个雨季 2021-01-28 04:30

Is it possible to programmatically copy a file into, or create a symbolic link in the /data/data/application_package/lib directory?

When trying to write to the lib dire

相关标签:
2条回答
  • 2021-01-28 05:07

    if you want load so file ,you can use system.load(); you can copy so to data/package name/libs

    and use system.load() to load so

    0 讨论(0)
  • 2021-01-28 05:11

    You cannot write to lib/, however you do not need to.

    You can write to any non-reserved location within your your application's private storage area, and you can load a native library from any file on the device for which you have read and execute permission, using System.load() with the full pathname, rather than System.loadLibrary() with the short library name.

    The external storage (sdcard) is mounted with a non-executable flag, but a file in your private storage directory would be a workable solution. Just be sure to make it only writable by your application, so that something else can't change it behind your back (it is because you cannot protect external storage files from such modification that the external storage is non-executable)

    0 讨论(0)
提交回复
热议问题