Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Change library loader to soloader #14890

Merged
merged 1 commit into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions platform/android/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox GL uses portions of the ReLinker.
URL: [https://github.com/KeepSafe/ReLinker](https://github.com/KeepSafe/ReLinker)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
Mapbox GL uses portions of the SoLoader.
URL: [https://github.com/facebook/soloader](https://github.com/facebook/soloader)
License: [BSD License](https://github.com/facebook/soloader/blob/master/LICENSE)

===========================================================================

Expand Down
2 changes: 1 addition & 1 deletion platform/android/MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {
implementation dependenciesList.supportAnnotations
implementation dependenciesList.supportFragmentV4
implementation dependenciesList.okhttp3
implementation dependenciesList.reLinker
implementation dependenciesList.soLoader
testImplementation dependenciesList.junit
testImplementation dependenciesList.mockito
testImplementation dependenciesList.mockk
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.mapbox.mapboxsdk.module.loader;

import android.content.Context;
import com.getkeepsafe.relinker.ReLinker;
import com.mapbox.mapboxsdk.LibraryLoader;
import com.mapbox.mapboxsdk.LibraryLoaderProvider;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException;
import com.mapbox.mapboxsdk.log.Logger;

import static com.facebook.soloader.SoLoader.init;
import static com.facebook.soloader.SoLoader.loadLibrary;

/**
* Concrete implementation of a native library loader.
* <p>
Expand All @@ -23,36 +24,26 @@ public class LibraryLoaderProviderImpl implements LibraryLoaderProvider {
*/
@Override
public LibraryLoader getDefaultLibraryLoader() {
return new ReLinkerLibraryLoader();
return new SoLibraryLoader();
}

/**
* Concrete implementation of a LibraryLoader using ReLinker.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ReLinker

*/
private static class ReLinkerLibraryLoader extends LibraryLoader {
private static class SoLibraryLoader extends LibraryLoader {

private static final String TAG = "SoLibraryLoader";

@Override
public void load(String name) {
try {
Context context = Mapbox.getApplicationContext();
ReLinker.log(new LibraryLogger()).loadLibrary(context, name);
// nativeExopackage = false, https://buck.build/article/exopackage.html
init(Mapbox.getApplicationContext(), false);
loadLibrary(name);
} catch (MapboxConfigurationException exception) {
Logger.e(LibraryLogger.TAG, "Couldn't load so file with relinker, application context missing, "
Logger.e(TAG, "Couldn't load so file with relinker, application context missing, "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relinker -> soloader

+ "call Mapbox.getInstance(Context context, String accessToken) first");
}
}

/**
* Relinker library loader logger.
*/
private static class LibraryLogger implements ReLinker.Logger {

private static final String TAG = "Mbgl-LibraryLoader";

@Override
public void log(String message) {
Logger.d(TAG, message);
}
}
}
}
4 changes: 2 additions & 2 deletions platform/android/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ext {
androidPublish : '3.6.2',
lint : '26.1.4',
gms : '16.0.0',
reLinker : '1.3.1',
soLoader : '0.6.0',
jacoco : '0.8.3'
]

Expand Down Expand Up @@ -68,7 +68,7 @@ ext {
okhttp3 : "com.squareup.okhttp3:okhttp:${versions.okhttp}",
leakCanaryDebug : "com.squareup.leakcanary:leakcanary-android:${versions.leakCanary}",
leakCanaryRelease : "com.squareup.leakcanary:leakcanary-android-no-op:${versions.leakCanary}",
reLinker : "com.getkeepsafe.relinker:relinker:${versions.reLinker}",
soLoader : "com.facebook.soloader:soloader:${versions.soLoader}",

kotlinLib : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}",
kotlinPlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
Expand Down