Fallback to System.loadLibrary if SoLoader has not been initialized

Reviewed By: lucasr

Differential Revision: D3661990

fbshipit-source-id: f2003577aa3d2f89ec579b6f889fdfb684110b60
This commit is contained in:
Emil Sjolander 2016-08-04 08:20:06 -07:00 committed by Facebook Github Bot 2
parent 5fd6c0903e
commit 44e7a88620
1 changed files with 7 additions and 1 deletions

View File

@ -20,7 +20,13 @@ import com.facebook.soloader.SoLoader;
public class CSSNodeJNI implements CSSNodeAPI<CSSNodeJNI> {
static {
SoLoader.loadLibrary("csslayout");
try {
SoLoader.loadLibrary("csslayout");
} catch (Exception ignored) {
// The user probably didn't call SoLoader.init(). Fall back to System.loadLibrary() instead.
System.out.println("Falling back to System.loadLibrary()");
System.loadLibrary("csslayout");
}
}
private CSSNodeJNI mParent;