Skip to content

Error: android.content.res.Resources$NotFoundException RCTSlider (Android) #17560

Description

@salujaharkirat

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 7.2.1
npm: 3.10.10
Watchman: 4.7.0
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react-native: 0.48.1 => 0.47.2
react: 16.0.0-alpha.12 => 16.0.0-alpha.12

Steps to Reproduce

I have an application in which I use TextInput with Slider. When I slide on the slider it updates the value in the component state.

I keep the value in my component state and read this value in TextInput. The value in the text input is treated as the final value which i use elsewhere.

Following is my code:-

class CustomSlider extends React.Component {
state = {
amount: 4000
};
render () {
return (
<View>
<TextInput value={this.state.value}
/>
<Slider
maximumValue={100000}
minimumValue={0}
step={1000}
onValueChange={(amount) => this.setState({amount})}
/> </View>
);
}
}

While this code works fine on iOS in android release build crashes randomly at times showing following error.

android.content.res.Resources$NotFoundException Drawable android:drawable/seekbar_thumb_material_anim with resource ID #0x1080692 unknown file unknown method
Caused by: java.lang.NullPointerException Attempt to read from field 'android.animation.Animator android.animation.AnimatorSet$Node.mAnimation' on a null object reference AnimatorSet.java:725 android.animation.AnimatorSet.clone
AnimatorSet.java:682 android.animation.AnimatorSet.clone
Animator.java:589 android.animation.Animator$AnimatorConstantState.newInstance
Animator.java:588 android.animation.Animator$AnimatorConstantState.newInstance
ConstantState.java:53 android.content.res.ConstantState.newInstance
ConstantState.java:61 android.content.res.ConstantState.newInstance
ConfigurationBoundResourceCache.java:40 android.content.res.ConfigurationBoundResourceCache.getInstance
AnimatorInflater.java:114 android.animation.AnimatorInflater.loadAnimator
AnimatedVectorDrawable.java:876 android.graphics.drawable.AnimatedVectorDrawable$AnimatedVectorDrawableState$PendingAnimator.newInstance
AnimatedVectorDrawable.java:852 android.graphics.drawable.AnimatedVectorDrawable$AnimatedVectorDrawableState.inflatePendingAnimators
AnimatedVectorDrawable.java:681 android.graphics.drawable.AnimatedVectorDrawable.applyTheme
DrawableContainer.java:953 android.graphics.drawable.DrawableContainer$DrawableContainerState.applyTheme
DrawableContainer.java:612 android.graphics.drawable.DrawableContainer.applyTheme
StateListDrawable.java:371 android.graphics.drawable.StateListDrawable.applyTheme
AnimatedStateListDrawable.java:392 android.graphics.drawable.AnimatedStateListDrawable.applyTheme
ResourcesImpl.java:594 android.content.res.ResourcesImpl.loadDrawable
MiuiResourcesImpl.java:308 android.content.res.MiuiResourcesImpl.loadDrawable
Resources.java:876 android.content.res.Resources.loadDrawable
TypedArray.java:930 android.content.res.TypedArray.getDrawable
AbsSeekBar.java:99 android.widget.AbsSeekBar.<init>
SeekBar.java:85 android.widget.SeekBar.<init>
SeekBar.java:81 android.widget.SeekBar.<init>
ReactSlider.java:56 com.facebook.react.views.slider.ReactSlider.<init>
ReactSliderManager.java:124 com.facebook.react.views.slider.ReactSliderManager.createViewInstance
ReactSliderManager.java:42 com.facebook.react.views.slider.ReactSliderManager.createViewInstance
ViewManager.java:46 com.facebook.react.uimanager.ViewManager.createView
NativeViewHierarchyManager.java:218 com.facebook.react.uimanager.NativeViewHierarchyManager.createView
UIViewOperationQueue.java:150 com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute
UIViewOperationQueue.java:923 com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations
UIViewOperationQueue.java:895 com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded
GuardedFrameCallback.java:31 com.facebook.react.uimanager.GuardedFrameCallback.doFrame
ReactChoreographer.java:136 com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame
ChoreographerCompat.java:107 com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame
Choreographer.java:874 android.view.Choreographer$CallbackRecord.run
Choreographer.java:688 android.view.Choreographer.doCallbacks
Choreographer.java:620 android.view.Choreographer.doFrame
Choreographer.java:862 android.view.Choreographer$FrameDisplayEventReceiver.run
Handler.java:754 android.os.Handler.handleCallback
Handler.java:95 android.os.Handler.dispatchMessage
Looper.java:163 android.os.Looper.loop
ActivityThread.java:6205 android.app.ActivityThread.main
Method.java:-2 java.lang.reflect.Method.invoke
ZygoteInit.java:904 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
ZygoteInit.java:794 com.android.internal.os.ZygoteInit.main

I think this issue is related to #9979.

Expected Behavior

Android build should not crash

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: AndroidAndroid applications.Ran CommandsOne of our bots successfully processed a command.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions