question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WrongAbiError - Fatal Exception on launch of x86_64 Android Emulator with Flipper integration

See original GitHub issue

🐛 Bug Report

I am unable to launch my built app w/ Flipper support in an Android x86 based emulator.

I can run on any ARM device, with no issues, just Android x86 / x86_64 emulators fail.

I appear to have all the needed pieces within my Gradle file regarding ABI support:

ndk {
      abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }

Output log from console on emulator launch:

W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.target.ui.debug/lib-main/libfbjni.so" has unexpected e_machine: 40 (EM_ARM)
        at java.lang.Runtime.load0(Runtime.java:928)
        at java.lang.System.load(System.java:1633)
        at com.facebook.soloader.SoLoader$1.load(SoLoader.java:393)
        at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:77)
        at com.facebook.soloader.UnpackingSoSource.loadLibrary(UnpackingSoSource.java:458)
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:731)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
        at com.facebook.soloader.NativeLoaderToSoLoaderDelegate.loadLibrary(NativeLoaderToSoLoaderDelegate.java:24)
        at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:43)
        at com.facebook.jni.HybridData.<clinit>(HybridData.java:31)
        at com.facebook.flipper.android.FlipperThread.run(FlipperThread.java:25)
E/SoLoader: couldn't find DSO to load: libfbjni.so caused by: dlopen failed: "/data/data/com.target.ui.debug/lib-main/libfbjni.so" has unexpected e_machine: 40 (EM_ARM)
E/AndroidRuntime: FATAL EXCEPTION: FlipperConnectionThread
    Process: com.target.ui.debug, PID: 3250
    com.facebook.soloader.SoLoader$WrongAbiError: APK was built for a different platform
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:645)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
        at com.facebook.soloader.NativeLoaderToSoLoaderDelegate.loadLibrary(NativeLoaderToSoLoaderDelegate.java:24)
        at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:43)
        at com.facebook.jni.HybridData.<clinit>(HybridData.java:31)
        at com.facebook.flipper.android.FlipperThread.run(FlipperThread.java:25)
     Caused by: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfbjni.so caused by: dlopen failed: "/data/data/com.target.ui.debug/lib-main/libfbjni.so" has unexpected e_machine: 40 (EM_ARM)
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577) 
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525) 
        at com.facebook.soloader.NativeLoaderToSoLoaderDelegate.loadLibrary(NativeLoaderToSoLoaderDelegate.java:24) 
        at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:43) 
        at com.facebook.jni.HybridData.<clinit>(HybridData.java:31) 
        at com.facebook.flipper.android.FlipperThread.run(FlipperThread.java:25) 
E/AndroidRuntime: FATAL EXCEPTION: FlipperEventBaseThread
    Process: com.target.ui.debug, PID: 3250
    java.lang.NoClassDefFoundError: <clinit> failed for class com.facebook.flipper.android.EventBase; see exception in other thread
        at com.facebook.flipper.android.FlipperThread.run(FlipperThread.java:25)

To Reproduce

Unknown, seems to only occur on some workstations for our Android app team.

Environment

Android Studio 3.5.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
krunk4evercommented, Dec 6, 2019

We were able to get some more data on this. It looks like it may be dependent on which Android API level your emulator is using. We got word that for some users, switching emulators help resolve the issue and so far my own testing has shown:

  • Pixel 2 + API 28 = crash
  • Pixel 2 + API 29 = no crash
  • Pixel + API 28 = crash
3reactions
DanEdgarTargetcommented, Nov 29, 2019

I am going to apologize in advance for not being able to provide a repro repo.

On a 20+ person team, this issue is occurring on 2 workstations.

That leads me to believe that it isn’t necessarily a repo based issue, but something environmental on the given machines?

I have tried things like repairing NDK, deleting all Gradle deps and forcing new, … all to no avail.

Is there some core part of the SoLoader and/or AS / Gradle integration steps which could go bad? Is there some other Gradle / AS config issue which could lead to this independent of repo / source files? Is there some core permission issue with folders? … Looking for any SoLoader help on this one.

Thank you for any consideration, and for your valuable time spent on this so far. I am still brainstorming / digging on my side, but haven’t surfaced any solutions for over a week since this started occurring.

I am working around it by just direct targeting an ARM based Android phone which is always connected, which seems to work every build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Emulator unable to connect to Flipper - Stack Overflow
In the flipper application: Open the Settings from the bottom left gear wheel, then "Settings"; Change the "Android SDK location" value to ...
Read more >
Adding Flipper to Android apps with Gradle
To set up Flipper for Android, you need to add the necessary dependencies to your app, initialize the Flipper client and enable the...
Read more >
flipper Crashes on emulator - TypeScript - GitAnswer
3 Answer: · go to android>app inside app delete build folder and rebuild the application again it worked for me very well. Also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found