Skip to content

Commit 137772e

Browse files
Pass version to ReLinker so it knows when to update workaround file.
1 parent 11841c1 commit 137772e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

objectbox-java/src/main/java/io/objectbox/BoxStore.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public class BoxStore implements Closeable {
6262
/** On Android used for native library loading. */
6363
@Nullable public static Object context;
6464
@Nullable public static Object relinker;
65+
/** Change so ReLinker will update native library when using workaround loading. */
66+
public static final String JNI_VERSION = "2.4.0";
6567

6668
private static final String VERSION = "2.4.0-2019-01-08";
6769
private static BoxStore defaultStore;

objectbox-java/src/main/java/io/objectbox/internal/NativeLibraryLoader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ private static boolean loadLibraryAndroid(String libname) {
134134
if (BoxStore.relinker == null) {
135135
// use default ReLinker
136136
Class<?> relinker = Class.forName("com.getkeepsafe.relinker.ReLinker");
137-
Method loadLibrary = relinker.getMethod("loadLibrary", context, String.class);
138-
loadLibrary.invoke(null, BoxStore.context, libname);
137+
Method loadLibrary = relinker.getMethod("loadLibrary", context, String.class, String.class);
138+
loadLibrary.invoke(null, BoxStore.context, libname, BoxStore.JNI_VERSION);
139139
} else {
140140
// use custom ReLinkerInstance
141-
Method loadLibrary = BoxStore.relinker.getClass().getMethod("loadLibrary", context, String.class);
142-
loadLibrary.invoke(BoxStore.relinker, BoxStore.context, libname);
141+
Method loadLibrary = BoxStore.relinker.getClass().getMethod("loadLibrary", context, String.class, String.class);
142+
loadLibrary.invoke(BoxStore.relinker, BoxStore.context, libname, BoxStore.JNI_VERSION);
143143
}
144144
} catch (ReflectiveOperationException e) {
145145
// note: do not catch Exception as it will swallow ReLinker exceptions useful for debugging

0 commit comments

Comments
 (0)