You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When showing / hiding the app by going to the capgo browser, the splashscreen forces the mobile app to completely crash on Redmi device, resulting in the error below (java.lang.NullPointerException).
Exception **java.lang.NullPointerException**: Attempt to invoke virtual method 'android.content.Context android.view.View.getContext()' on a null object reference
at android.view.WindowManagerImpl.addView (WindowManagerImpl.java:169)
at com.capacitorjs.plugins.splashscreen.SplashScreen.lambda$show$7 (SplashScreen.java:452)
at com.capacitorjs.plugins.splashscreen.SplashScreen.$r8$lambda$A2qMbW91Y0O72KVpVNhkOgLCt-I (Unknown Source)
at com.capacitorjs.plugins.splashscreen.SplashScreen$$ExternalSyntheticLambda6.run (D8$$SyntheticClass)
at android.os.Handler.handleCallback (Handler.java:958)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:224)
at android.os.Looper.loop (Looper.java:318)
at android.app.ActivityThread.main (ActivityThread.java:8765)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1013)
Expected Behavior
When showing / hiding the app by going to the capgo browser, the splashscreen does not force the app to crash on Redmi device.
Other Technical Details
The error has currently only be observed on Redmi garnet (Redmi Note 13 Pro 5G) on Android 14.
Other devices f.e. Samsung Galaxy S24 on Android 14 works fine.
Additional Context
Gemini diagnosis:
`
The app crashed because it tried to call getContext() on a View object that was null. This happened when the app was trying to add a view to the WindowManager, likely related to showing the splash screen using the Capacitor Splash Screen plugin. Essentially, the code expected a view to exist, but it wasn't there, causing a NullPointerException. This occurred on the main thread.
Potential Solutions
Check for null before calling getContext(): The most likely cause is that the view being added to the WindowManager is null. This could happen if the view failed to inflate or was not properly initialized. A null check should be added before calling getContext() on the view. It can be assumed that this is happening inside com.capacitorjs.plugins.splashscreen.SplashScreen.show(), so that method should be checked for issues.
// Example inside SplashScreen.java show() method
if (splashScreenView != null) {
Context context = splashScreenView.getContext();
// ... rest of the code
} else {
// Handle the case where splashScreenView is null, perhaps by logging the error or attempting to re-initialize the view
Log.e("SplashScreen", "splashScreenView is null");
}
Verify Splash Screen View initialization: Ensure the splash screen view is being created and initialized correctly before it's added to the WindowManager. Double check XML layout files for errors and ensure resources are properly linked if the view is inflated from an XML layout. If the view is created programmatically, verify all the necessary steps are completed.
// Example (if view is inflated from XML):
View splashScreenView = LayoutInflater.from(context).inflate(R.layout.splash_screen, null);
// Make sure R.layout.splash_screen is a valid layout resource
if (splashScreenView == null) {
Log.e("SplashScreen", "Failed to inflate splash_screen layout");
return; // or throw an exception
}
Review Splash Screen Plugin Configuration: The Capacitor Splash Screen plugin might have configuration options related to the view's creation or display. Consult the plugin's documentation to ensure it is being used correctly and all necessary configurations are in place. If there are options for fallback behavior or error handling, make sure they are implemented correctly to prevent crashes. Look for any configuration related to delaying the hiding of the Splash Screen, since the error occurs in the SplashScreen.show() method. It's possible that showing the Splash Screen is being called at the wrong time or in a situation where it has already been shown.
`
The text was updated successfully, but these errors were encountered:
This issue needs more information before it can be addressed.
In particular, the reporter needs to provide a minimal sample app that demonstrates the issue.
If no sample app is provided within 15 days, the issue will be closed.
Bug Report
Plugin(s)
Capacitor Version
Platform(s)
android 14 (SDK 34)
Current Behavior
When showing / hiding the app by going to the capgo browser, the splashscreen forces the mobile app to completely crash on Redmi device, resulting in the error below (java.lang.NullPointerException).
Expected Behavior
When showing / hiding the app by going to the capgo browser, the splashscreen does not force the app to crash on Redmi device.
Other Technical Details
The error has currently only be observed on Redmi garnet (Redmi Note 13 Pro 5G) on Android 14.
Other devices f.e. Samsung Galaxy S24 on Android 14 works fine.
Additional Context
Gemini diagnosis:
`
The app crashed because it tried to call getContext() on a View object that was null. This happened when the app was trying to add a view to the WindowManager, likely related to showing the splash screen using the Capacitor Splash Screen plugin. Essentially, the code expected a view to exist, but it wasn't there, causing a NullPointerException. This occurred on the main thread.
Potential Solutions
Check for null before calling getContext(): The most likely cause is that the view being added to the WindowManager is null. This could happen if the view failed to inflate or was not properly initialized. A null check should be added before calling getContext() on the view. It can be assumed that this is happening inside com.capacitorjs.plugins.splashscreen.SplashScreen.show(), so that method should be checked for issues.
// Example inside SplashScreen.java show() method
if (splashScreenView != null) {
Context context = splashScreenView.getContext();
// ... rest of the code
} else {
// Handle the case where splashScreenView is null, perhaps by logging the error or attempting to re-initialize the view
Log.e("SplashScreen", "splashScreenView is null");
}
Verify Splash Screen View initialization: Ensure the splash screen view is being created and initialized correctly before it's added to the WindowManager. Double check XML layout files for errors and ensure resources are properly linked if the view is inflated from an XML layout. If the view is created programmatically, verify all the necessary steps are completed.
// Example (if view is inflated from XML):
View splashScreenView = LayoutInflater.from(context).inflate(R.layout.splash_screen, null);
// Make sure R.layout.splash_screen is a valid layout resource
if (splashScreenView == null) {
Log.e("SplashScreen", "Failed to inflate splash_screen layout");
return; // or throw an exception
}
Review Splash Screen Plugin Configuration: The Capacitor Splash Screen plugin might have configuration options related to the view's creation or display. Consult the plugin's documentation to ensure it is being used correctly and all necessary configurations are in place. If there are options for fallback behavior or error handling, make sure they are implemented correctly to prevent crashes. Look for any configuration related to delaying the hiding of the Splash Screen, since the error occurs in the SplashScreen.show() method. It's possible that showing the Splash Screen is being called at the wrong time or in a situation where it has already been shown.
`
The text was updated successfully, but these errors were encountered: