LD_LIBRARY_PATH ignored on Android sometimes

后端 未结 4 2046
有刺的猬
有刺的猬 2021-02-06 15:59

i have an android app which spawns many native executables dinamically linked with libraries i distribute with the package. To launch those binaries, i use the LD_LIBRARY_PATH e

4条回答
  •  难免孤独
    2021-02-06 16:09

    I don't think the LD_LIBRARY_PATH will be ignored. The way you update the system environment is ok. The LD_LIBRARY_PATH will get updated under the root user.

    The solution will not be able to work on some machine may have several causes:

    1. The Android app is always run under its own user id. It is not run under root privilege. If you only modify the system variable of the root user. The application may still cannot find the correct library path in its own envrionment.

    2. Even if you correctly updated the LD_LIBRARY_PATH when the application initialize itself, you still need to make sure the application's corresponding user id do have the access to read those libraries.

    3. Some vendor will modify the Android kernel for some security reasons. They may disable the loading of 3rd-party libraries from external storage or something like that.

提交回复
热议问题