Catch native lib load errors

This commit is contained in:
DrKLO 2014-06-14 16:18:58 +04:00
parent 02a20acc4c
commit 8c9616cb00
5 changed files with 34 additions and 12 deletions

View file

@ -81,7 +81,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 254
versionCode 255
versionName "1.5.3"
}
}

View file

@ -1,6 +1,7 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := tmessages
LOCAL_CFLAGS := -w -std=gnu99 -O3 -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno

View file

@ -110,7 +110,7 @@ public class FileLog {
}
}
public static void e(final String tag, final Exception e) {
public static void e(final String tag, final Throwable e) {
if (!BuildVars.DEBUG_VERSION) {
return;
}

View file

@ -54,6 +54,12 @@ public class NativeLoader {
return;
}
try {
System.loadLibrary("jnigraphics");
} catch (Error e) {
FileLog.e("tmessages", e);
}
try {
String folder = null;
long libSize = 0;
@ -96,8 +102,8 @@ public class NativeLoader {
System.loadLibrary("tmessages");
nativeLoaded = true;
return;
} catch (Exception e) {
e.printStackTrace();
} catch (Error e) {
FileLog.e("tmessages", e);
}
}
}
@ -110,8 +116,8 @@ public class NativeLoader {
System.load(destLocalFile.getAbsolutePath());
nativeLoaded = true;
return;
} catch (Exception e) {
e.printStackTrace();
} catch (Error e) {
FileLog.e("tmessages", e);
}
} else {
destLocalFile.delete();
@ -139,8 +145,12 @@ public class NativeLoader {
}
out.close();
System.load(destLocalFile.getAbsolutePath());
nativeLoaded = true;
try {
System.load(destLocalFile.getAbsolutePath());
nativeLoaded = true;
} catch (Error e) {
FileLog.e("tmessages", e);
}
return;
} catch (Exception e) {
FileLog.e("tmessages", e);
@ -164,7 +174,11 @@ public class NativeLoader {
e.printStackTrace();
}
System.loadLibrary("tmessages");
nativeLoaded = true;
try {
System.loadLibrary("tmessages");
nativeLoaded = true;
} catch (Error e) {
FileLog.e("tmessages", e);
}
}
}

View file

@ -262,10 +262,17 @@ public class Utilities {
public static File getCacheDir() {
if (externalCacheNotAvailableState == 1 || externalCacheNotAvailableState == 0 && Environment.getExternalStorageState().startsWith(Environment.MEDIA_MOUNTED)) {
externalCacheNotAvailableState = 1;
return ApplicationLoader.applicationContext.getExternalCacheDir();
File file = ApplicationLoader.applicationContext.getExternalCacheDir();
if (file != null) {
return file;
}
}
externalCacheNotAvailableState = 2;
return ApplicationLoader.applicationContext.getCacheDir();
File file = ApplicationLoader.applicationContext.getCacheDir();
if (file != null) {
return file;
}
return new File("");
}
public static String bytesToHex(byte[] bytes) {