[Crash] - java.lang.NoClassDefFoundError: com.facebook.yoga.YogaNative #1697
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Report
Issues and Steps to Reproduce
Hi,
App is crashing with the below error logs. I have added the library versions used and targetSDK.
Please let me know if any other details needed.
Library Versions
CompileSdk & targetSdk: API 34
Hi team,
We have upgraded to
com.facebook.yoga:yoga:3.1.0
and can still see this crash. This is causing major crashes in production, any help would be highly appreciated.I don't think we can help here without a repro.
If you are running a tool like Proguard or something else for obfuscation, please be sure it is not stripping classnames. Yoga ships a proguard config which should be applied automatically for plain Gradle builds. https://github.com/facebook/yoga/blob/main/java/proguard-rules.pro
@NickGerleman - Thanks for replying.
We are not able to reproduce this issue, hence we are not able to provide a sample repo with this issue.
We are using Proguard and we have added rules to keep Yoga classes as is but still we are facing this issue.
Below are the Proguard rules we are using -
-keep class com.facebook.** {*;}
-keep class com.facebook.yoga.YogaNative**
-keepclassmembers class com.facebook.yoga.YogaNative** { ; }
-keepnames class com.facebook.yoga.YogaNative* { *; }
-keepresourcefiles /lib//libfb.so
-keepresourcefiles /lib//libyoga.so
If not already being pulled into build, you probably want to reuse the rules we distribute, linked above. E.g. we have specific DoNotStrip and DoNotStrip any annotations that mark members in code, instead of specific classes.
But I just noticed the bottom line:
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "/data/app/~~xGOlWuwpixyh8jh3ttfiug==/com.paypal.android.p2pmobile-wsJVFl7hIC9rW_ydT0EU9Q==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libyoga.so" not found
So, that suggests the underlying binary is not present?
Yes @NickGerleman , we were also suspecting that the actual native library is not present, leading to the crash. Any idea how the native library could go missing?
we use the latest SoLoader library to load and one more fact is that this crash does not happen in all android devices, only for the below devices we observed.
Not really sure. That’s probably not going to be related ri the aar we distribute. Maybe something related to useLegacyPackaging/extractNativeLibs?
@NickGerleman , setting
useLegacyPackaging = true
, will it not increase the app install and app download size?https://developer.android.com/build/releases/past-releases/agp-4-2-0-release-notes#compress-native-libs-dsl
Yes, ideally you would not use it, if minSdk supports it everywhere, and it is applied consistently.
@NickGerleman , our current min sdk is 23, i guess there should not be a problem. Still should we add
useLegacyPackaging = true
to solve the issue? or do you think any other issue could cause the problem ?I think it is more likely something else (just spitting out guesses, in case mismatches might cause issues)? Any chance your app ships code lazily/downloaded outside of Play Store?
I'm going to close this issue out though, since I don't think this is an issue with the Yoga AAR with publish, but I'd be curious to learn what the issue is if you all are able to figure it out.