enisn / UraniumUI

Uranium is a Free & Open-Source UI Kit for MAUI.
Apache License 2.0
1.19k stars 142 forks source link

Android app sometimes crashes, FontAwesome is culprit #664

Open tolgraven opened 6 months ago

tolgraven commented 6 months ago

Deep in Android...

crc645d80431ce5f73f11.GroupableItemsViewAdapter_2.onBindViewHolder
GroupableItemsViewAdapter_2.java, line 48
Java.Lang.RuntimeException: Font asset not found /data/user/0/com.opter.driver2/cache/FontAwesome6Free-Solid-900.otf
Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* )
Java.Interop.JniPeerMembers.JniStaticMethods.InvokeObjectMethod(String , JniArgumentValue* )
Android.Graphics.Typeface.CreateFromAsset(AssetManager , String )
Java.Interop.JniEnvironment.StaticMethods.CallStaticLongMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* )
Java.Interop.JniPeerMembers.JniStaticMethods.InvokeInt64Method(String , JniArgumentValue* )
Microsoft.Maui.PlatformInterop.MeasureAndGetWidthAndHeight(View view, Int32 widthMeasureSpec, Int32 heightMeasureSpec)
crc645d80431ce5f73f11.GroupableItemsViewAdapter_2.onBindViewHolder GroupableItemsViewAdapter_2.java:48
androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder RecyclerView.java:7678
androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder RecyclerView.java:7761
androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline RecyclerView.java:6582
androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline RecyclerView.java:6848
androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition RecyclerView.java:6688
androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition RecyclerView.java:6684
androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next LinearLayoutManager.java:2362
androidx.recyclerview.widget.LinearLayoutManager.layoutChunk LinearLayoutManager.java:1662
androidx.recyclerview.widget.LinearLayoutManager.fill LinearLayoutManager.java:1622
androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren LinearLayoutManager.java:687
androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2 RecyclerView.java:4604
androidx.recyclerview.widget.RecyclerView.onMeasure RecyclerView.java:3981
android.view.View.measure View.java:27131
com.microsoft.maui.PlatformInterop.measureAndGetWidthAndHeight PlatformInterop.java:378
crc6452ffdc5b34af3a0f.ContentViewGroup.n_onMeasure(Native Method)
crc6452ffdc5b34af3a0f.ContentViewGroup.onMeasure ContentViewGroup.java:59
android.view.View.measure View.java:27131
androidx.core.widget.NestedScrollView.measureChildWithMargins NestedScrollView.java:1921
android.widget.FrameLayout.onMeasure FrameLayout.java:194
androidx.core.widget.NestedScrollView.onMeasure NestedScrollView.java:640
android.view.View.measure View.java:27131
androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onMeasure SwipeRefreshLayout.java:705
android.view.View.measure View.java:27131
com.microsoft.maui.PlatformInterop.measureAndGetWidthAndHeight PlatformInterop.java:378
crc6452ffdc5b34af3a0f.LayoutViewGroup.n_onMeasure(Native Method)
crc6452ffdc5b34af3a0f.LayoutViewGroup.onMeasure LayoutViewGroup.java:59
android.view.View.measure View.java:27131
com.microsoft.maui.PlatformInterop.measureAndGetWidthAndHeight PlatformInterop.java:378
crc6452ffdc5b34af3a0f.LayoutViewGroup.n_onMeasure(Native Method)
crc6452ffdc5b34af3a0f.LayoutViewGroup.onMeasure LayoutViewGroup.java:59
android.view.View.measure View.java:27131
com.microsoft.maui.PlatformInterop.measureAndGetWidthAndHeight PlatformInterop.java:378
crc6452ffdc5b34af3a0f.LayoutViewGroup.n_onMeasure(Native Method)
crc6452ffdc5b34af3a0f.LayoutViewGroup.onMeasure LayoutViewGroup.java:59
android.view.View.measure View.java:27131
com.microsoft.maui.PlatformInterop.measureAndGetWidthAndHeight PlatformInterop.java:378
crc6452ffdc5b34af3a0f.ContentViewGroup.n_onMeasure(Native Method)
crc6452ffdc5b34af3a0f.ContentViewGroup.onMeasure ContentViewGroup.java:59
android.view.View.measure View.java:27131
crc640ec207abc449b2ca.ShellPageContainer.onMeasure ShellPageContainer.java:66
android.view.View.measure View.java:27131
androidx.recyclerview.widget.RecyclerView$LayoutManager.measureChildWithMargins RecyclerView.java:10124
androidx.recyclerview.widget.LinearLayoutManager.layoutChunk LinearLayoutManager.java:1688
androidx.recyclerview.widget.LinearLayoutManager.fill LinearLayoutManager.java:1622
androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren LinearLayoutManager.java:687
androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2 RecyclerView.java:4604
androidx.recyclerview.widget.RecyclerView.dispatchLayout RecyclerView.java:4307
androidx.recyclerview.widget.RecyclerView.onLayout RecyclerView.java:4873
android.view.View.layout View.java:24475
androidx.viewpager2.widget.ViewPager2.onLayout ViewPager2.java:527
android.view.View.layout View.java:24475
androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout CoordinatorLayout.java:953
android.view.View.layout View.java:24475
androidx.drawerlayout.widget.DrawerLayout.onLayout DrawerLayout.java:1273
android.view.View.layout View.java:24475

Not sure if the issue is on our end somehow, or with UraniumUI/FontAwesome. For the component causing the issue we're using FASolid font "directly", for icon labels in a CollectionView template. Not sure why it's looking in cache either when it's bundled?

tolgraven commented 6 months ago

Other times get exceptions in log, but without crashing:

141|2024-05-21T20:34:18.4678408+00:00|TRACE|1|Created Logger 'FontManager'
142|2024-05-21T20:34:18.4777304+00:00|WARN|1|FontManager|Unable to load font '/data/user/0/com.opter.driver2/cache/FontAwesome6Free-Solid-900.otf' from assets. --> Java.Lang.RuntimeException: Font asset not found /data/user/0/com.opter.driver2/cache/FontAwesome6Free-Solid-900.otf
   at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference type, JniMethodInfo method, JniArgumentValue* args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/net7.0/JniEnvironment.g.cs:line 21452
   at Java.Interop.JniPeerMembers.JniStaticMethods.InvokeObjectMethod(String encodedMember, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniStaticMethods.cs:line 165
   at Android.Graphics.Typeface.CreateFromAsset(AssetManager mgr, String path) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Android.Graphics.Typeface.cs:line 637
   at Microsoft.Maui.FontManager.LoadTypefaceFromAsset(String fontfamily, Boolean warning) in D:\a\_work\1\s\src\Core\src\Fonts\FontManager.Android.cs:line 132
  --- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: Font asset not found /data/user/0/com.opter.driver2/cache/FontAwesome6Free-Solid-900.otf
    at android.graphics.Typeface.createFromAsset(Typeface.java:1061)
    at crc6452ffdc5b34af3a0f.ScopedFragment.n_onCreateView(Native Method)
    at crc6452ffdc5b34af3a0f.ScopedFragment.onCreateView(ScopedFragment.java:49)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3042)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1839)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8177)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

  --- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: Font asset not found /data/user/0/com.opter.driver2/cache/FontAwesome6Free-Solid-900.otf
    at android.graphics.Typeface.createFromAsset(Typeface.java:1061)
    at crc6452ffdc5b34af3a0f.ScopedFragment.n_onCreateView(Native Method)
    at crc6452ffdc5b34af3a0f.ScopedFragment.onCreateView(ScopedFragment.java:49)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3042)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1839)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8177)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)