java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.nullcognition.litho/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit
Create a project, import all gradle dependencies(uncomment testing dep.), add App application class, change manifest application name to App class, init SoLoader in App, add Testing your Installation code, run.
Now, when you run the app you should see “Hello World!” displayed on the screen.
https://github.com/ersin-ertan/android-ui/tree/master/litho
SoLoader issue for 32 and 64-bit @rspencer01
Device: Galaxy Tab S2
@ersin-ertan When are you seeing this error? Does this happen when you run it in Android Studio or with Gradle from the terminal? Could you give some information about the platform you're running this on? Linux, Mac, etc.?
Mac
Android Studio
E/AndroidRuntime
The app will run if setContentView(lithoView); is commented out.
Also, the github landing page and the getting started litho docs code differ but with no semantic difference.
final ComponentContext c = new ComponentContext(this);
final LithoView lithoView = LithoView.create(
this /* context */,
Text.create(c)
.text("Hello, World!")
.textSizeDip(50)
.build());
setContentView(lithoView);
// vs
final ComponentContext context = new ComponentContext(this);
final Component component = Text.create(context)
.text("Hello World")
.textSizeDip(50)
.build();
setContentView(LithoView.create(context, component));
@ersin-ertan Thanks for the details! I've never tried to run it on an x86_64 emulator myself. I'm doing that now.
@ersin-ertan Thanks for your patience! I have been able to repro this. It seems like we've bundled the wrong architecture of libgnustl_shared.so into the last release of Yoga which does the layout.
As a workaround, you can use an x86 (32bit instead of 64bit) emulator for now. Sorry for that, we'll try to fix this as quickly as possible, but it will require a new release of Yoga and Litho.
/cc @emilsjolander
Quick update: It's not the packaging. During SoLoader#initImpl we extract the wrong architecture to lib-main/. If you load the app on an x86_64 device and check the files under /data/user/.../litho-app/lib-main/*.so they're all ELF 32-bit LSB shared object and not 64-bit as they should.
/cc @rspencer01 Just in case you're interested because I know you've fought with this before.
@ersin-ertan
It looks like the solution to this problem is actually incredibly boring. @rspencer01 fixed this exact problem and there has been a new release of the library. We did, however, forget to update the references in the tutorials to point to that release.
If you change this line to
compile 'com.facebook.soloader:soloader:0.2.0'
then everything is working again on x86_64.
Sorry for the confusion and thanks for raising this. I'll update the docs and close this afterwards.
I thought this looked familiar! :D