[Crash] - java.lang.NoClassDefFoundError: com.facebook.yoga.YogaNative #1697

Closed
opened 2024-09-17 20:53:40 -07:00 by varunajaygupta · 10 comments
varunajaygupta commented 2024-09-17 20:53:40 -07:00 (Migrated from github.com)

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.

java.lang.NoClassDefFoundError: com.facebook.yoga.YogaNative
	at com.facebook.yoga.YogaNodeJNIBase.<init>(:56)
	at com.facebook.yoga.YogaNodeJNIFinalizer.<init>(:12)
	at com.facebook.yoga.YogaNodeFactory.create(:12)
	at com.facebook.yoga.android.YogaLayout.<init>(:82)
	at com.facebook.yoga.android.YogaLayout.<init>(:72)
	at o.awxt.<init>(:9)
	at o.awvp.b(:1019)
	at o.awvn.b(:1025)
	at o.awzr.onCreateViewHolder(:11061)
	at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(:7295)
	at androidx.recyclerview.widget.RecyclerView$Recycler.a(:6416)
	at androidx.recyclerview.widget.RecyclerView$Recycler.c(:6300)
	at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.b(:22296)
	at androidx.recyclerview.widget.LinearLayoutManager.d(:1631)
	at androidx.recyclerview.widget.LinearLayoutManager.b(:1591)
	at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(:668)
	at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(:4309)
	at androidx.recyclerview.widget.RecyclerView.onMeasure(:3686)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at o.fj.c(:1401)
	at o.fj.d(:685)
	at o.fj.onMeasure(:575)
	at android.view.View.measure(View.java:28571)
	at androidx.recyclerview.widget.RecyclerView$LayoutManager.measureChildWithMargins(:9681)
	at androidx.recyclerview.widget.LinearLayoutManager.d(:1657)
	at androidx.recyclerview.widget.LinearLayoutManager.b(:1591)
	at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(:668)
	at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(:4309)
	at androidx.recyclerview.widget.RecyclerView.onMeasure(:3686)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at o.fj.c(:1401)
	at o.fj.d(:685)
	at o.fj.onMeasure(:575)
	at android.view.View.measure(View.java:28571)
	at o.diq.measureChildWithMargins(:1921)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at o.diq.onMeasure(:640)
	at android.view.View.measure(View.java:28571)
	at o.cxc$a.d(:811)
	at o.cus.c(:632)
	at o.cus.e(:733)
	at o.cvg.a(:160)
	at o.cus.d(:51336)
	at o.cxc.resolveSystem(:1594)
	at o.cxc.onMeasure(:1708)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:28571)
	at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
	at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at o.ev.onMeasure(:145)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
	at com.android.internal.policy.DecorView.onMeasure(DecorView.java:1036)
	at android.view.View.measure(View.java:28571)
	at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:5203)
	at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:3603)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3973)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3288)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:11344)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1689)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1698)
	at android.view.Choreographer.doCallbacks(Choreographer.java:1153)
	at android.view.Choreographer.doFrame(Choreographer.java:1079)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1646)
	at android.os.Handler.handleCallback(Handler.java:958)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:230)
	at android.os.Looper.loop(Looper.java:319)
	at android.app.ActivityThread.main(ActivityThread.java:8919)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "/data/app/~~xGOlWuwpixyh8jh3ttfiug==/com.*************.-wsJVFl7hIC9rW_ydT0EU9Q==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libyoga.so" not found
	

Library Versions

    1. com.facebook.yoga:yoga:2.0.0
    2. com.facebook.soloader:soloader:0.10.5
    3. com.facebook.fbjni:fbjni:0.5.1

CompileSdk & targetSdk: API 34

# Report - [X] I have searched [existing issues](https://github.com/facebook/yoga/issues) and this is not a duplicate # 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. ``` java.lang.NoClassDefFoundError: com.facebook.yoga.YogaNative at com.facebook.yoga.YogaNodeJNIBase.<init>(:56) at com.facebook.yoga.YogaNodeJNIFinalizer.<init>(:12) at com.facebook.yoga.YogaNodeFactory.create(:12) at com.facebook.yoga.android.YogaLayout.<init>(:82) at com.facebook.yoga.android.YogaLayout.<init>(:72) at o.awxt.<init>(:9) at o.awvp.b(:1019) at o.awvn.b(:1025) at o.awzr.onCreateViewHolder(:11061) at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(:7295) at androidx.recyclerview.widget.RecyclerView$Recycler.a(:6416) at androidx.recyclerview.widget.RecyclerView$Recycler.c(:6300) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.b(:22296) at androidx.recyclerview.widget.LinearLayoutManager.d(:1631) at androidx.recyclerview.widget.LinearLayoutManager.b(:1591) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(:668) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(:4309) at androidx.recyclerview.widget.RecyclerView.onMeasure(:3686) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608) at android.widget.LinearLayout.measureVertical(LinearLayout.java:878) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608) at android.widget.LinearLayout.measureVertical(LinearLayout.java:878) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at o.fj.c(:1401) at o.fj.d(:685) at o.fj.onMeasure(:575) at android.view.View.measure(View.java:28571) at androidx.recyclerview.widget.RecyclerView$LayoutManager.measureChildWithMargins(:9681) at androidx.recyclerview.widget.LinearLayoutManager.d(:1657) at androidx.recyclerview.widget.LinearLayoutManager.b(:1591) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(:668) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(:4309) at androidx.recyclerview.widget.RecyclerView.onMeasure(:3686) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at o.fj.c(:1401) at o.fj.d(:685) at o.fj.onMeasure(:575) at android.view.View.measure(View.java:28571) at o.diq.measureChildWithMargins(:1921) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at o.diq.onMeasure(:640) at android.view.View.measure(View.java:28571) at o.cxc$a.d(:811) at o.cus.c(:632) at o.cus.e(:733) at o.cvg.a(:160) at o.cus.d(:51336) at o.cxc.resolveSystem(:1594) at o.cxc.onMeasure(:1708) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:28571) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at o.ev.onMeasure(:145) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608) at android.widget.LinearLayout.measureVertical(LinearLayout.java:878) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608) at android.widget.LinearLayout.measureVertical(LinearLayout.java:878) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:28571) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7390) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:1036) at android.view.View.measure(View.java:28571) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:5203) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:3603) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3973) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3288) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:11344) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1689) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1698) at android.view.Choreographer.doCallbacks(Choreographer.java:1153) at android.view.Choreographer.doFrame(Choreographer.java:1079) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1646) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:8919) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103) Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "/data/app/~~xGOlWuwpixyh8jh3ttfiug==/com.*************.-wsJVFl7hIC9rW_ydT0EU9Q==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libyoga.so" not found ``` Library Versions 1. com.facebook.yoga:yoga:2.0.0 2. com.facebook.soloader:soloader:0.10.5 3. com.facebook.fbjni:fbjni:0.5.1 CompileSdk & targetSdk: API 34
varunajaygupta commented 2024-10-14 04:47:38 -07:00 (Migrated from github.com)

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.

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.
NickGerleman commented 2024-10-14 11:20:00 -07:00 (Migrated from github.com)

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

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
varunajaygupta commented 2024-10-16 01:41:01 -07:00 (Migrated from github.com)

@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

@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
NickGerleman commented 2024-10-16 03:36:28 -07:00 (Migrated from github.com)

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?

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?
SanthoshKandalu commented 2024-10-16 03:56:46 -07:00 (Migrated from github.com)

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.

Screenshot 2024-08-28 at 1 42 35 PM

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. ![Screenshot 2024-08-28 at 1 42 35 PM](https://github.com/user-attachments/assets/27950c00-4d99-459d-a823-bc01768b60b1)
NickGerleman commented 2024-10-16 04:19:13 -07:00 (Migrated from github.com)

Not really sure. That’s probably not going to be related ri the aar we distribute. Maybe something related to useLegacyPackaging/extractNativeLibs?

Not really sure. That’s probably not going to be related ri the aar we distribute. Maybe something related to useLegacyPackaging/extractNativeLibs?
SanthoshKandalu commented 2024-10-16 05:52:33 -07:00 (Migrated from github.com)

@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

@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
NickGerleman commented 2024-10-17 00:54:53 -07:00 (Migrated from github.com)

Yes, ideally you would not use it, if minSdk supports it everywhere, and it is applied consistently.

Yes, ideally you would not use it, if minSdk supports it everywhere, and it is applied consistently.
SanthoshKandalu commented 2024-10-22 00:48:43 -07:00 (Migrated from github.com)

@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 ?

@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 ?
NickGerleman commented 2024-10-22 09:41:01 -07:00 (Migrated from github.com)

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.

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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DaddyFrosty/yoga#1697
No description provided.