summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobrun <tobrun.van.nuland@gmail.com>2019-01-17 12:57:53 +0100
committerTobrun <tobrun@mapbox.com>2019-01-17 13:31:45 +0100
commitf0392e0471a2e045eef3eba5fdcaef2066bd579e (patch)
tree08454449b3fcb1819858ba18b0f33265aee147f0
parent16718b0df77119dd4bbebc383bfbd70afb1c0518 (diff)
downloadqtlocation-mapboxgl-f0392e0471a2e045eef3eba5fdcaef2066bd579e.tar.gz
[android] - make all library loader load the native library only once
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/LibraryLoader.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/LibraryLoader.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/LibraryLoader.java
index 48417047d5..66047ee934 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/LibraryLoader.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/LibraryLoader.java
@@ -16,16 +16,13 @@ public abstract class LibraryLoader {
private static final LibraryLoader DEFAULT = new LibraryLoader() {
@Override
public void load(String name) {
- if (!loaded) {
- System.loadLibrary(name);
- }
- loaded = true;
+ System.loadLibrary(name);
}
};
private static volatile LibraryLoader loader = DEFAULT;
- protected static boolean loaded;
+ private static boolean loaded;
/**
* Set the library loader that loads the shared library.
@@ -44,7 +41,10 @@ public abstract class LibraryLoader {
*/
public static void load() {
try {
- loader.load("mapbox-gl");
+ if (!loaded) {
+ loader.load("mapbox-gl");
+ }
+ loaded = true;
} catch (UnsatisfiedLinkError error) {
String message = "Failed to load native shared library.";
Logger.e(TAG, message, error);