From f0392e0471a2e045eef3eba5fdcaef2066bd579e Mon Sep 17 00:00:00 2001 From: tobrun Date: Thu, 17 Jan 2019 12:57:53 +0100 Subject: [android] - make all library loader load the native library only once --- .../src/main/java/com/mapbox/mapboxsdk/LibraryLoader.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'platform/android') 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); -- cgit v1.2.1