diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index 3b0a37c19..bf4f3c4cc 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -62,6 +62,8 @@ public class MessagesStorage { } public void openDatabase() { + NativeLoader.initNativeLibs(ApplicationLoader.applicationContext); + cacheFile = new File(ApplicationLoader.applicationContext.getFilesDir(), "cache4.db"); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("dbconfig", Context.MODE_PRIVATE); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java index 2c00ee014..e07bb6366 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java @@ -28,7 +28,14 @@ public class NativeLoader { 0, //mips }; - public static void initNativeLibs(Context context) { + private static volatile boolean nativeLoaded = false; + + public static synchronized void initNativeLibs(Context context) { + if (nativeLoaded) { + return; + } + nativeLoaded = true; + if (Build.VERSION.SDK_INT >= 9) { try { String folder = null;