Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #43674

Closed
Rc85 opened this issue Mar 27, 2024 · 6 comments
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍 Newer Patch Available Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Rc85
Copy link

Rc85 commented Mar 27, 2024

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

@github-actions github-actions bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Mar 27, 2024
Copy link

⚠️ Missing Reproducible Example
ℹ️ 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.

Copy link

⚠️ Newer Version of React Native is Available!
ℹ️ 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 github-actions bot added the Platform: Android Android applications. label Mar 27, 2024
@cortinico
Copy link
Contributor

Cannot reproduce as it is random

Please provide a reproducer as we can't fix this

Copy link

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 github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Apr 21, 2024
Copy link

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

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 28, 2024
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍 Newer Patch Available Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants