ExoPlayer
ExoPlayer copied to clipboard
Caused by android.content.res.Resources$NotFoundException Drawable (missing name) with resource ID #0x7f08009c
ExoPlayer Version
2.16.1
Devices that reproduce the issue
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
No
Reproduction steps
1 in PlayerView Construct(), will create PlayerControlView
public PlayerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { this.controller = new PlayerControlView(context, null, 0, attrs); }
2 in PlayerControlView, will infate View with layout
public PlayerControlView() { int controllerLayoutId = R.layout.exo_player_control_view;
3 in exo_player_control_view xml layout, has ImageButton
<ImageButton android:id="@id/exo_prev" style="@style/ExoMediaButton.Previous"/>
4 which sytle is
</style> <style name="ExoMediaButton.Previous"> <item name="android:src">@drawable/exo_controls_previous</item> <item name="android:contentDescription">@string/exo_controls_previous_description</item> </style>
the problem is that the exo_controls_previous drawable could't be fond。 help me how to resolve this problem!
Expected result
not crash
Actual result
Caused by android.content.res.Resources$NotFoundException
Unable to find resource ID #0x7f08009c
android.content.res.ResourcesImpl.getResourceName (ResourcesImpl.java:294)
android.content.res.ResourcesImpl.loadDrawableForCookie (ResourcesImpl.java:994)
android.content.res.ResourcesImpl.loadDrawable (ResourcesImpl.java:729)
android.content.res.Resources.loadDrawable (Resources.java:1096)
android.content.res.TypedArray.getDrawableForDensity (TypedArray.java:1006)
android.content.res.TypedArray.getDrawable (TypedArray.java:981)
android.widget.ImageView.
Media
no others
Bug Report
- [X] You will email the zip file produced by
adb bugreport
to [email protected] after filing this issue.
I'm not able to reproduce the problem. I checked out the demo app at 2.16.1 and modified PlayerActivity
(and its layout file) to use PlayerView
instead of StyledPlayerView
. The app launches and plays videos without a problem.
The drawable ID that your exception says is missing is defined here in 2.16.1: https://github.com/google/ExoPlayer/blob/r2.16.1/library/ui/src/main/res/values/drawables.xml#L20
Without being able to reproduce I'm afraid there's not much more help we can offer.
Something similar is rarely happening for us too:
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/playerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/md_black_1000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:use_controller="false" />
Caused by android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f0800d0
at android.content.res.ResourcesImpl.getResourceName(ResourcesImpl.java:287)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:854)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:694)
at android.content.res.Resources.loadDrawable(Resources.java:993)
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:1006)
at android.content.res.TypedArray.getDrawable(TypedArray.java:981)
at android.widget.ImageView.<init>(ImageView.java:209)
at android.widget.ImageButton.<init>(ImageButton.java:86)
at android.widget.ImageButton.<init>(ImageButton.java:82)
at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:78)
at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:73)
at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:231)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:146)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1682)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1733)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:240)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1065)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:995)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1138)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1141)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1141)
at android.view.LayoutInflater.inflate(LayoutInflater.java:654)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at com.google.android.exoplayer2.ui.StyledPlayerControlView.<init>(StyledPlayerControlView.java:423)
at com.google.android.exoplayer2.ui.StyledPlayerView.<init>(StyledPlayerView.java:452)
at com.google.android.exoplayer2.ui.StyledPlayerView.<init>(StyledPlayerView.java:268)
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1138)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1141)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at androidx.fragment.app.Fragment.onCreateView(Fragment.java:2020)
at app.ui.common.AbstractBindingFragment.onCreateView(AbstractBindingFragment.kt:25)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3104)
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:1890)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1135)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1814)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:92)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1751)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:74)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:538)
at androidx.fragment.app.DefaultSpecialEffectsController$4$1.run$bridge(DefaultSpecialEffectsController.java:37)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:268)
at android.app.ActivityThread.main(ActivityThread.java:8019)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
Caused by android.content.res.Resources$NotFoundException: Drawable (missing name) with resource ID #0x7f0800d0
Caused by android.view.InflateException: Binary XML file line #64 in app:layout/exo_styled_player_control_view: Error inflating class ImageButton
Caused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1138)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1141)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at androidx.fragment.app.Fragment.onCreateView(Fragment.java:2020)
at app.ui.common.AbstractBindingFragment.onCreateView(AbstractBindingFragment.kt:25)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3104)
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:1890)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1135)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1814)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:92)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1751)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:74)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:538)
at androidx.fragment.app.DefaultSpecialEffectsController$4$1.run$bridge(DefaultSpecialEffectsController.java:37)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:268)
at android.app.ActivityThread.main(ActivityThread.java:8019)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
Caused by android.view.InflateException: Binary XML file line #23 in app:layout/fragment_clip: Error inflating class com.google.android.exoplayer2.ui.StyledPlayerView
Same issue here, not happening very often but for a few users (~0.1%, with different device manufacturers and OS versions, no apparent pattern there)
...
Caused by android.view.InflateException: Binary XML file line #33 in com.playtomic:layout/exo_player_control_view: Binary XML file line #33 in com.playtomic:layout/exo_player_control_view: Error inflating class ImageButton
Caused by android.view.InflateException: Binary XML file line #33 in com.playtomic:layout/exo_player_control_view: Error inflating class ImageButton
Caused by android.content.res.Resources$NotFoundException: Drawable (missing name) with resource ID #0x7f0801c6
Caused by android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f0801c6
at android.content.res.ResourcesImpl.getResourcePackageName(ResourcesImpl.java:451)
at android.content.res.ResourcesImplEx.getResourcePackageName(ResourcesImplEx.java:50)
at android.content.res.HwResourcesImpl.getThemePackageName(HwResourcesImpl.java:1872)
at android.content.res.HwResourcesImpl.loadDrawable(HwResourcesImpl.java:1471)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:964)
at android.content.res.Resources.loadDrawable(Resources.java:1004)
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:1195)
at android.content.res.TypedArray.getDrawable(TypedArray.java:1170)
at android.widget.ImageView.<init>(ImageView.java:238)
at android.widget.ImageButton.<init>(ImageButton.java:86)
at android.widget.ImageButton.<init>(ImageButton.java:82)
at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:78)
at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:73)
at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:226)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:141)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1565)
at androidx.appcompat.app.PhraseBaseAppCompatDelegate.createView(SourceFile:1)
at androidx.appcompat.app.PhraseAppCompatDelegate.createView(SourceFile:3)
at androidx.appcompat.app.PhraseAppCompatDelegate$factory2$1.onCreateView(SourceFile:1)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1071)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1007)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:971)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1133)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1136)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
at android.view.LayoutInflater.inflate(LayoutInflater.java:692)
at android.view.LayoutInflater.inflate(LayoutInflater.java:536)
at android.view.LayoutInflater.inflate(LayoutInflater.java:483)
at com.google.android.exoplayer2.ui.PlayerControlView.<init>(PlayerControlView.java:421)
at com.google.android.exoplayer2.ui.PlayerView.<init>(PlayerView.java:502)
at com.google.android.exoplayer2.ui.PlayerView.<init>(PlayerView.java:322)
at com.google.android.exoplayer2.ui.PlayerView.<init>(PlayerView.java:318)
at com.playtomicui.components.video.PlaytomicVideoView.<init>(PlaytomicVideoView.kt:66)
at com.playtomicui.components.video.PlaytomicVideoView.<init>(PlaytomicVideoView.kt:29)
at com.playtomicui.components.video.PlaytomicVideoView.<init>(:13)
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:864)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1016)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:971)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1133)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
at android.view.LayoutInflater.inflate(LayoutInflater.java:692)
at android.view.LayoutInflater.inflate(LayoutInflater.java:536)
at com.playtomicui.core.PlaytomicFragment.onCreateView(PlaytomicFragment.kt:62)
at com.playtomic.modules.onboarding.view.OnboardingAuthFragment.onCreateView(OnboardingAuthFragment.kt:79)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
at androidx.fragment.app.FragmentManager.dispatchPause(FragmentManager.java:3090)
at androidx.fragment.app.Fragment.performPause(Fragment.java:3161)
at androidx.fragment.app.FragmentStateManager.pause(FragmentStateManager.java:632)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:314)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
at androidx.fragment.app.FragmentManager.dispatchPause(FragmentManager.java:3090)
at androidx.fragment.app.FragmentController.dispatchPause(FragmentController.java:284)
at androidx.fragment.app.FragmentActivity.onPause(FragmentActivity.java:390)
at android.app.Activity.performPause(Activity.java:8307)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1529)
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5239)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5198)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5138)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:46)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:105)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2462)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8393)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
however, in my case compared to the one above, the video player is embeded into some other component of mine, so the XML looks like:
<com.playtomicui.components.video.PlaytomicVideoView
android:id="@+id/onboarding_auth_playtomic_video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false" />
and the PlaytomicVideoView
instantiated the Exo player inside a FrameLayout
with:
private var videoView = PlayerView(context).apply {
[email protected](
this,
LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT
).apply { gravity = Gravity.CENTER_HORIZONTAL }
)
if (isInEditMode) {
setBackgroundColor(ContextCompat.getColor(context, R.color.secondary_energy))
}
z = 10F
}
....
videoPlayer = SimpleExoPlayer.Builder(context).build()
videoPlayer?.repeatMode = if (isLoop) Player.REPEAT_MODE_ALL else Player.REPEAT_MODE_OFF
videoView.resizeMode = scaleType.toExoPlayerResize()
videoView.player = videoPlayer
videoPlayer?.setMediaSource(getMediaSource(videoUrl))
videoPlayer?.prepare()
videoPlayer?.volume = if (autoPlaySound) 1F else 0F
videoView.useController = false
videoPlayer?.addListener(object : Player.Listener {
override fun onPlaybackStateChanged(playbackState: Int) {
if (playbackState == Player.STATE_ENDED) {
playerItemDidPlayToEndTime()
}
}
})
Are there any solutions or workarounds yet? I'm getting this crash from 2 different apps's crashlytics already.
I think it is explained here https://stackoverflow.com/questions/50471888/android-app-bundle-introduces-resource-not-found-crash-in-android-app
The problem is that some people try to sideload APKs, which was not properly generated from App Bundles...
Thanks for the pointer - that does look like an explanation for the symptoms described here. I'm going to close this since it's not something that can be fixed by ExoPlayer.