react-native icon indicating copy to clipboard operation
react-native copied to clipboard

java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)' on a null object reference

Open Rc85 opened this issue 1 year ago • 4 comments

Description

I see many closed issue that is the same as this and there is no solution or even a fix. I am still facing this issue in production. The crash occurred when I was tapping on a TextInput for focus.

If it helps, these are the logs in the same time frame before the crash

2024-03-27T11:04:17.333Z  924  libPowerHal  [perfNotifyAppState] pack:com.munchies.run.merchant.android, act:com.munchies.run.merchant.android.MainActivity, state:5, pid:22822, uid:10231, fps:60

2024-03-27T11:04:17.631Z  932  BufferQueueProducet 
 [com.munchies.run.merchant.android/com.munchies.run.merchant.android.MainActivity#11833](this:0xb400007774fd1e08,id:-1,api:0,p:-1,c:932) queueBuffer: fps=7.66 dur=1174.61 max=509.28 min=16.53

And after

2024-03-27T11:04:17.979Z  1333  mtkpower_client  [Legacy][PowerHal_Wrap_notifyAppState] com.munchies.run.merchant.android/com.munchies.run.merchant.android pid=22822 state:3

2024-03-27T11:04:17.980Z  1333  game_scn  collectForegroundAppList packName=com.munchies.run.merchant.android, actName=com.munchies.run.merchant.android, pid=22822, uid=10231, state:DEAD

2024-03-27T11:04:17.980Z  924  libPowerHal  [perfNotifyAppState] pack:com.munchies.run.merchant.android, act:com.munchies.run.merchant.android, state:3, pid:22822, uid:10231, fps:60

2024-03-27T11:04:17.981Z  924  libPowerHal  [perfNotifyAppState] pack:com.munchies.run.merchant.android, pid:22822, STATE_DEAD

2024-03-27T11:04:17.988Z  1333  ActivityTaskManager  Force finishing activity com.munchies.run.merchant.android/.MainActivity

2024-03-27T11:04:17.993Z  932  SurfaceFlinger  operator()(), mtkRenderCntDebug 420, screenshot (com.munchies.run.merchant.android/com.munchies.run.merchant.android.MainActivity#11833)

Steps to reproduce

  1. Tap on TextInput
  2. Hope for the error

React Native Version

0.72.6

Affected Platforms

Build - Windows

Output of npx react-native info

System:
  OS: Windows 10 10.0.19045
  CPU: "(16) x64 AMD Ryzen 7 2700X Eight-Core Processor         "
  Memory: 16.76 GB / 31.93 GB
Binaries:
  Node:
    version: 20.8.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.10
    path: ~\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 10.1.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman:
    version: 20210102.202219.0
    path: C:\Users\roger\watchman\bin\watchman.EXE
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-212.5712.43.2112.8815526
  Visual Studio:
    - 15.9.28307.1401 (Visual Studio Community 2017)
Languages:
  Java: 17.0.1
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

FATAL EXCEPTION: main

java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)' on a null object reference

FATAL EXCEPTION: main
Process: com.munchies.run.merchant.android, PID: 22822
java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)' on a null object reference
	at android.graphics.drawable.DrawableContainer$DrawableContainerState.createAllFutures(DrawableContainer.java:879)
	at android.graphics.drawable.DrawableContainer$DrawableContainerState.getOpacity(DrawableContainer.java:1162)
	at android.graphics.drawable.DrawableContainer.getOpacity(DrawableContainer.java:433)
	at android.graphics.drawable.InsetDrawable.getOpacity(InsetDrawable.java:260)
	at android.view.View.computeOpaqueFlags(View.java:19547)
	at android.view.View.setBackgroundDrawable(View.java:24801)
	at androidx.appcompat.widget.AppCompatEditText.setBackgroundDrawable(AppCompatEditText.java:180)
	at android.view.View.setBackground(View.java:24694)
	at android.view.View.<init>(View.java:6111)
	at android.widget.TextView.<init>(TextView.java:1072)
	at android.widget.EditText.<init>(EditText.java:88)
	at android.widget.EditText.<init>(EditText.java:84)
	at androidx.appcompat.widget.AppCompatEditText.<init>(AppCompatEditText.java:97)
	at androidx.appcompat.widget.AppCompatEditText.<init>(AppCompatEditText.java:92)
	at androidx.appcompat.widget.AppCompatEditText.<init>(AppCompatEditText.java:88)
	at com.facebook.react.views.textinput.ReactEditText.<init>(ReactEditText.java:137)
	at com.facebook.react.views.textinput.ReactTextInputManager.createViewInstance(ReactTextInputManager.java:191)
	at com.facebook.react.views.textinput.ReactTextInputManager.createViewInstance(ReactTextInputManager.java:86)
	at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:183)
	at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:115)
	at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281)
	at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:194)
	at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1110)
	at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1081)
	at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
	at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
	at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1313)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1323)
	at android.view.Choreographer.doCallbacks(Choreographer.java:956)
	at android.view.Choreographer.doFrame(Choreographer.java:863)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1298)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7946)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1019)

FATAL EXCEPTION: mqt_native_modules
Process: com.munchies.run.merchant.android, PID: 22822
java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)' on a null object reference
	at android.graphics.drawable.DrawableContainer$DrawableContainerState.createAllFutures(DrawableContainer.java:879)
	at android.graphics.drawable.DrawableContainer$DrawableContainerState.getOpacity(DrawableContainer.java:1162)
	at android.graphics.drawable.DrawableContainer.getOpacity(DrawableContainer.java:433)
	at android.graphics.drawable.InsetDrawable.getOpacity(InsetDrawable.java:260)
	at android.view.View.computeOpaqueFlags(View.java:19547)
	at android.view.View.setBackgroundDrawable(View.java:24801)
	at android.view.View.setBackground(View.java:24694)
	at android.view.View.<init>(View.java:6111)
	at android.widget.TextView.<init>(TextView.java:1072)
	at android.widget.EditText.<init>(EditText.java:88)
	at android.widget.EditText.<init>(EditText.java:84)
	at android.widget.EditText.<init>(EditText.java:80)
	at android.widget.EditText.<init>(EditText.java:76)
	at com.facebook.react.views.textinput.ReactTextInputShadowNode.createInternalEditText(ReactTextInputShadowNode.java:236)
	at com.facebook.react.views.textinput.ReactTextInputShadowNode.setThemedContext(ReactTextInputShadowNode.java:82)
	at com.facebook.react.uimanager.UIImplementation.createView(UIImplementation.java:239)
	at com.facebook.react.uimanager.UIManagerModule.createView(UIManagerModule.java:419)
	at com.facebook.react.uimanager.ReanimatedUIManager.createView(ReanimatedUIManager.java:51)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
	at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
	at com.facebook.jni.NativeRunnable.run(Native Method)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
	at java.lang.Thread.run(Thread.java:1012)

Reproducer

Cannot reproduce as it is random

Screenshots and Videos

No response

Rc85 avatar Mar 27 '24 11:03 Rc85

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

github-actions[bot] avatar Mar 27 '24 11:03 github-actions[bot]

:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.72.12. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

github-actions[bot] avatar Mar 27 '24 11:03 github-actions[bot]

Cannot reproduce as it is random

Please provide a reproducer as we can't fix this

cortinico avatar Mar 27 '24 13:03 cortinico

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

github-actions[bot] avatar Apr 21 '24 05:04 github-actions[bot]

This issue was closed because the author hasn't provided the requested feedback after 7 days.

github-actions[bot] avatar Apr 28 '24 05:04 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Apr 28 '24 05:04 github-actions[bot]