ReLinker is a small library to help alleviate UnsatisfiedLinkError exceptions thrown due to Android's inability to properly install / load native libraries for Android versions before API 23.
| 25 | * API 23. |
| 26 | */ |
| 27 | public class ReLinker { |
| 28 | public interface LoadListener { |
| 29 | void success(); |
| 30 | void failure(Throwable t); |
| 31 | } |
| 32 | |
| 33 | public interface Logger { |
| 34 | void log(String message); |
| 35 | } |
| 36 | |
| 37 | public interface LibraryLoader { |
| 38 | void loadLibrary(String libraryName); |
| 39 | void loadPath(String libraryPath); |
| 40 | String mapLibraryName(String libraryName); |
| 41 | String unmapLibraryName(String mappedLibraryName); |
| 42 | String[] supportedAbis(); |
| 43 | } |
| 44 | |
| 45 | public interface LibraryInstaller { |
| 46 | void installLibrary(Context context, String[] abis, String mappedLibraryName, |
| 47 | File destination, ReLinkerInstance logger); |
| 48 | } |
| 49 | |
| 50 | public static void loadLibrary(final Context context, final String library) { |
| 51 | loadLibrary(context, library, null, null); |
| 52 | } |
| 53 | |
| 54 | public static void loadLibrary(final Context context, |
| 55 | final String library, |
| 56 | final String version) { |
| 57 | loadLibrary(context, library, version, null); |
| 58 | } |
| 59 | |
| 60 | public static void loadLibrary(final Context context, |
| 61 | final String library, |
| 62 | final LoadListener listener) { |
| 63 | loadLibrary(context, library, null, listener); |
| 64 | } |
| 65 | |
| 66 | public static void loadLibrary(final Context context, |
| 67 | final String library, |
| 68 | final String version, |
| 69 | final ReLinker.LoadListener listener) { |
| 70 | new ReLinkerInstance().loadLibrary(context, library, version, listener); |
| 71 | } |
| 72 | |
| 73 | public static ReLinkerInstance force() { |
| 74 | return new ReLinkerInstance().force(); |
| 75 | } |
| 76 | |
| 77 | public static ReLinkerInstance log(final Logger logger) { |
| 78 | return new ReLinkerInstance().log(logger); |
| 79 | } |
| 80 | |
| 81 | public static ReLinkerInstance recursively() { |
| 82 | return new ReLinkerInstance().recursively(); |
| 83 | } |
| 84 |
nothing calls this directly
no outgoing calls
no test coverage detected