google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

Issue# Resources$NotFoundException: Resource ID #0x7f080198 #11187

Closed deepakjain1989 closed 1 year ago

deepakjain1989 commented 1 year ago

Bug

Hello Team,

I am using below lib version of exo player. implementation 'com.google.android.exoplayer:exoplayer-core:2.18.4' implementation 'com.google.android.exoplayer:exoplayer-hls:2.18.4' implementation 'com.google.android.exoplayer:exoplayer-ui:2.18.4'

Getting below issue in some device and log are attach below.

Caused by android.content.res.Resources$NotFoundException: Resource ID #0x7f080198 at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:245) at android.content.res.Resources.getDrawableForDensity(Resources.java:982) at android.content.res.Resources.getDrawable(Resources.java:922) at com.google.android.exoplayer2.util.Util$Api21.getDrawable(Util.java:4) at com.google.android.exoplayer2.util.Util.getDrawable(Util.java:6) at com.google.android.exoplayer2.ui.PlayerControlView.(PlayerControlView.java:461) at com.google.android.exoplayer2.ui.PlayerView.(PlayerView.java:546) at com.google.android.exoplayer2.ui.PlayerView.(PlayerView.java:1) at java.lang.reflect.Constructor.newInstance0(Constructor.java) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:858) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1014) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1144) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1105) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1147) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1105) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1147) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1105) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1147) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1105) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1147) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1105) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1147) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1105) at android.view.LayoutInflater.inflate(LayoutInflater.java:686) at android.view.LayoutInflater.inflate(LayoutInflater.java:538) at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:14) at androidx.databinding.ViewDataBinding.inflateInternal(ViewDataBinding.java:4) at com.kidex.app.databinding.AdapterProgramVideosBinding.inflate(AdapterProgramVideosBinding.java:3) at com.kidex.app.databinding.AdapterProgramVideosBinding.inflate(AdapterProgramVideosBinding.java:4) at com.kidex.app.ui.adapters.CompetitionAdapter$HowProgramsWorkVideosViewHolder.(CompetitionAdapter.java:14) at com.kidex.app.ui.adapters.CompetitionAdapter.onCreateViewHolder(CompetitionAdapter.java:48) at com.kidex.app.ui.adapters.CompetitionAdapter.onCreateViewHolder(CompetitionAdapter.java) at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:207) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:1) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:11) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:38) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:356) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:66) at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:67) at android.view.View.measure(View.java:25980) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7122) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:25980) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7122) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:25980) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7122) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:25980) at androidx.core.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:38) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at androidx.core.widget.NestedScrollView.onMeasure(NestedScrollView.java) at android.view.View.measure(View.java:25980) at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:237) at android.view.View.measure(View.java:25980) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7122) at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java) at com.google.android.material.appbar.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:93) at com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java) at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:278) at android.view.View.measure(View.java:25980) at androidx.drawerlayout.widget.DrawerLayout.onMeasure(DrawerLayout.java:243) at android.view.View.measure(View.java:25980) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7122) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:154) at android.view.View.measure(View.java:25980) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7122) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:25980) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7122) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:25980) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7122) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:25980) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7122) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:764) at android.view.View.measure(View.java:25980) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3939) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2647) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2932) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2359) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9219) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1139) at android.view.Choreographer.doCallbacks(Choreographer.java:918) at android.view.Choreographer.doFrame(Choreographer.java:834) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1112) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:241) at android.os.Looper.loop(Looper.java:342) at android.app.ActivityThread.main(ActivityThread.java:8138) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:583) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

deepakjain1989 commented 1 year ago

Device list is OS version: android11 Model:Redmi Note 11 Pro

OS version: android10 Model:Vivo 1804

OS version: android11 Model:Realme XT

OS version: android11 Model:Realme C3

OS version: android12 Model:Tecno LE6j

OS version: android11 Model:Realme 5pro

icbaker commented 1 year ago

Duplicate of https://github.com/google/ExoPlayer/issues/10409

deepakjain1989 commented 1 year ago

This is almost certainly users sharing (sideloading) the app, either via P2P sharing programs, or uploading the APK to the web then other users downloading and installing from the web.

People used to dealing with non Android App Bundle apps just transfer and share the main APK. But your App bundle app has lots of "split APKs" for things like the resources, that is how the size saving happens. You can read all about this process on the help page. If a user installs the main APK without installing the right split APKs, then a "Resources Not found" crash will occur the first time the app tries to load a resource.

If you want to support users sideloading your app and just the main APK you could try to detect this situation and display a message to the user (without using any resources) that says "Please install from Google Play". Or you could just decide you aren't going to support users who share APKs in this way.

I suspect in the long run the websites and P2P sharing programs will get better at sharing such APKs properly, so I wouldn't spend too long worrying about it.

If you see this happening far more frequently on lower Android versions, this isn't probably due to a bug in lower Android versions. Instead, it is probably because in countries where users commonly P2P share apps (eg India) users also are far more likely to be on older version phones.

https://stackoverflow.com/questions/50471888/android-app-bundle-introduces-resource-not-found-crash-in-android-app