I am trying to dynamically load a native library libhello_world.so
into an example Android project. My goal is the application to run normally and at runtime to fetch the library and load it so it can be used.
Currently the structure of the android app is
├── AndroidManifest.xml
├── java
│ └── example
│ └── myapp
│ └── some
│ └── exampleapp
│ ├── Computation.java
│ └── MainActivity.java
├── jniLibs
│ ├── arm64-v8a
│ │ └── libhello_world.so
│ ├── armeabi-v7a
│ │ └── libhello_world.so
│ ├── x86
│ │ └── libhello_world.so
│ └── x86_64
│ └── libhello_world.so
└── res
├── layout
│ └── activity_main.xml
├── mipmap-hdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
├── mipmap-mdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
├── mipmap-xhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
├── mipmap-xxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
├── mipmap-xxxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
└── values
├── colors.xml
├── dimens.xml
├── strings.xml
└── styles.xml
I load the library like this
static {
System.loadLibrary("hello_world");
}
I would like now to be able somehow without obviously having the folder jniLibs
in the android project, to load the library from another path in the system or a URL. Imagive for example that the contents of the folder jniLibs
are located at the directory /tmp
. How would I specify that within the application so it can be found at runtime?
Is this possible and if yes how?