[android] Revert native loading behavior (#10180)

This commit is contained in:
Antonio Zugaldia
2017-10-11 09:06:58 -04:00
committed by GitHub
parent 50ee8daca1
commit 6d673799f8

View File

@@ -1,9 +1,5 @@
package com.mapbox.mapboxsdk;
import android.content.Context;
import java.io.File;
import timber.log.Timber;
/**
@@ -11,8 +7,6 @@ import timber.log.Timber;
*/
public class LibraryLoader {
private static final String LIBRARY_NAME = "libmapbox-gl.so";
/**
* Loads "libmapbox-gl.so" native shared library.
*/
@@ -20,22 +14,7 @@ public class LibraryLoader {
try {
System.loadLibrary("mapbox-gl");
} catch (UnsatisfiedLinkError error) {
Context context = Mapbox.getApplicationContext();
if (context != null) {
Timber.d("Loading %s from internal storage.", LIBRARY_NAME);
System.load(getLibraryLocation(context).getAbsolutePath());
}
Timber.e(error, "Failed to load native shared library.");
}
}
/**
* Returns a file in the app internal storage that may contain a locally cached copy
* of the Mapbox native library.
*
* @param context The application context
* @return a file object
*/
public static File getLibraryLocation(Context context) {
return new File(context.getFilesDir(), LIBRARY_NAME);
}
}