2

My Android app, within NDK built .so files, crashes on the ASUS ZenFone 5 device just like the issue in this link (Android) Native crash at /system/lib/libhoudini.so on Asus Phone

It seems the libhoudini.so, the ARM to x86 translator, can not work under certain conditions so I tried to directly provide an x86 arch .so file within my app.

The APK could run on most x86 devices including the x86 simulators. However, on this device I get an issue:

java.lang.UnsatisfiedLinkError: Couldn't load game from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.myapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapp-1, /vendor/lib, /system/lib, /system/lib/arm]]]: findLibrary returned null

It seems this Intel Atom based device ignores the lib/x86 folder in the APK file.

How can I make this device load the right so file with right arch?

Community
  • 1
  • 1
jayatubi
  • 1,972
  • 1
  • 21
  • 51
  • Make sure that you have x86 editions of everything, not just one `.so`. This includes any that you are pulling in from third-party libraries. – CommonsWare Oct 02 '15 at 16:05
  • I'm sure everything is ready. Because the same APK could run on other x86 devices including the x86 simulators. – jayatubi Oct 02 '15 at 16:07
  • On the Zenfone 5, if the package manager sees that your APK is having ARM libs that don't have x86 versions inside it, it's falling back to using the ARM libs since there are high risks of crash. This behavior is different than the one in the emulator and some other devices. – ph0b Oct 03 '15 at 05:42
  • @ph0b Do you mean once there is an `arm` .so within the APK, no matter what it is, the device will ignore all the other `x86` .so files? I tried to provide both `arm` and `x86` .so files but it didn't work neither on the ZenFone device. – jayatubi Oct 03 '15 at 05:47
  • @jayatubi no, I mean that if there is an *arm* .so within the APK, the device will install the x86 libs only of there is an *x86* .so file with the same name. If you have *armeabi-v7a/libfoo.so* and *armeabi-v7a/libbar.so*, you have to also have *x86/libfoo.so* and *x86/libbar.so* inside your APK. – ph0b Oct 03 '15 at 05:52
  • @ph0b I do have the x86 .so file in the APK but the ZenFone device seems always ignore that. I also tried only put x86 .so files, without any arm files, in the APK and most of the x86 devices works fine. Only the ZenFone tells it can not find the library. – jayatubi Oct 03 '15 at 06:00
  • @jayatubi it's still crashing when you only have x86 libs? In any case, you can check what lib is inside your APK and what lib get installed using this (my) application: https://play.google.com/store/apps/details?id=com.xh.nativelibsmonitor.app If you can then add your app details to your main question it will be easier to help (use the share button and paste the content). – ph0b Oct 03 '15 at 06:53
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/91239/discussion-between-jayatubi-and-ph0b). – jayatubi Oct 03 '15 at 12:04

0 Answers0