From a1c0e59a7755c895135346ea3634a0705fc9d848 Mon Sep 17 00:00:00 2001 From: xueqiushi Date: Wed, 20 Mar 2019 00:12:46 +0800 Subject: [PATCH] Fix https://github.com/KeepSafe/ReLinker/issues/49 Signed-off-by: xueqiushi --- .../com/getkeepsafe/relinker/ReLinkerInstance.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/relinker/src/main/java/com/getkeepsafe/relinker/ReLinkerInstance.java b/relinker/src/main/java/com/getkeepsafe/relinker/ReLinkerInstance.java index feb5233..494099c 100755 --- a/relinker/src/main/java/com/getkeepsafe/relinker/ReLinkerInstance.java +++ b/relinker/src/main/java/com/getkeepsafe/relinker/ReLinkerInstance.java @@ -16,6 +16,7 @@ package com.getkeepsafe.relinker; import android.content.Context; +import android.os.Build; import android.util.Log; import com.getkeepsafe.relinker.elf.ElfParser; @@ -30,6 +31,7 @@ public class ReLinkerInstance { private static final String LIB_DIR = "lib"; + private static final boolean DISABLE_VERSION = Build.VERSION.SDK_INT < Build.VERSION_CODES.M; protected final Set loadedLibraries = new HashSet(); protected final ReLinker.LibraryLoader libraryLoader; @@ -131,15 +133,21 @@ public void loadLibrary(final Context context, throw new IllegalArgumentException("Given library is either null or empty"); } + String adaptiveVersion = version; + if (DISABLE_VERSION) { + force = true; + adaptiveVersion = null; + } + log("Beginning load of %s...", library); if (listener == null) { - loadLibraryInternal(context, library, version); + loadLibraryInternal(context, library, adaptiveVersion); } else { new Thread(new Runnable() { @Override public void run() { try { - loadLibraryInternal(context, library, version); + loadLibraryInternal(context, library, adaptiveVersion); listener.success(); } catch (UnsatisfiedLinkError e) { listener.failure(e);