support aar and jar
This commit is contained in:
parent
7271f44f60
commit
df8a023e0b
|
@ -26,7 +26,9 @@ import com.mindspore.lite.NativeLibrary;
|
||||||
public class Version {
|
public class Version {
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
if (!NativeLibrary.loadLibrary()) {
|
||||||
NativeLibrary.loadLibs();
|
NativeLibrary.loadLibs();
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Failed to load MindSporLite native library.");
|
System.err.println("Failed to load MindSporLite native library.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -34,17 +34,30 @@ public class NativeLibrary {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean loadLibrary() {
|
public static boolean loadLibrary() {
|
||||||
|
boolean loadSuccess = false;
|
||||||
try {
|
try {
|
||||||
System.loadLibrary(GLOG_LIBNAME);
|
System.loadLibrary(GLOG_LIBNAME);
|
||||||
System.loadLibrary(MINDSPORE_LITE_LIBNAME);
|
LOGGER.info("loadLibrary " + GLOG_LIBNAME + ": success");
|
||||||
System.loadLibrary(MINDSPORE_LITE_JNI_LIBNAME);
|
loadSuccess = true;
|
||||||
LOGGER.info("loadLibrary: success");
|
|
||||||
return true;
|
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
LOGGER.warning("tryLoadLibraryFailed: " + e.getMessage());
|
LOGGER.info("tryLoadLibrary " + GLOG_LIBNAME + " failed: " + e.getMessage());
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
System.loadLibrary(MINDSPORE_LITE_LIBNAME);
|
||||||
|
LOGGER.info("loadLibrary " + MINDSPORE_LITE_LIBNAME + ": success");
|
||||||
|
loadSuccess = true;
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
LOGGER.info("tryLoadLibrary " + MINDSPORE_LITE_LIBNAME + " failed: " + e.getMessage());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
System.loadLibrary(MINDSPORE_LITE_JNI_LIBNAME);
|
||||||
|
LOGGER.info("loadLibrary " + MINDSPORE_LITE_JNI_LIBNAME + ": success");
|
||||||
|
loadSuccess = true;
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
LOGGER.info("tryLoadLibrary " + MINDSPORE_LITE_JNI_LIBNAME + " failed: " + e.getMessage());
|
||||||
|
}
|
||||||
|
return loadSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadLib(String libResourceName) {
|
private static void loadLib(String libResourceName) {
|
||||||
|
|
Loading…
Reference in New Issue