cordova-plugin-splashscreen: Crashes: android.content.res.Resources$NotFoundException
Bug
Description
I’m receiving several crash reports from Google Play that appear to be coming from Cordova splashscreen with the following exception:
android.content.res.Resources$NotFoundException:
at android.content.res.ResourcesImpl.getValueForDensity (ResourcesImpl.java:213)
at android.content.res.Resources.getDrawableForDensity (Resources.java:875)
at android.content.res.Resources.getDrawable (Resources.java:818)
at android.content.res.Resources.getDrawable (Resources.java:793)
at org.apache.cordova.splashscreen.SplashScreen.onConfigurationChanged (SplashScreen.java:213)
at org.apache.cordova.PluginManager.onConfigurationChanged (PluginManager.java:509)
at org.apache.cordova.CordovaActivity.onConfigurationChanged (CordovaActivity.java:493)
at android.app.ActivityThread.performActivityConfigurationChanged (ActivityThread.java:5182)
at android.app.ActivityThread.performConfigurationChangedForActivity (ActivityThread.java:5050)
at android.app.ActivityThread.performConfigurationChangedForActivity (ActivityThread.java:5028)
at android.app.ActivityThread.handleActivityConfigurationChanged (ActivityThread.java:5372)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1855)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6797)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:772)
Each stack trace looks almost exactly the same.
Information
So far the exception has only been reported from Android 8.0 and 8.1
Environment, Platform, Device
I added the plugin via the CLI and I build for production using the CLI, as well.
Version information
Cordova Android Engine 7.0.0 cordova-plugin-splashscreen 5.0.2
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (3 by maintainers)
Hello @janpio, This is the StackTrace in our case (almost the same):
android.content.res.Resources.getValue Resources.java:1352 android.content.res.Resources.getDrawable Resources.java:805 android.content.res.Resources.getDrawable Resources.java:772 org.apache.cordova.splashscreen.SplashScreen.onConfigurationChanged SplashScreen.java:213 org.apache.cordova.PluginManager.onConfigurationChanged PluginManager.java:509 org.apache.cordova.CordovaActivity.onConfigurationChanged CordovaActivity.java:493
But we have identified the issue, and it was basically because we didn’t provide the splashscreen for landscape resolutions, but only for portrait. We were able to reproduce the issue, and by adding the settings in the config.xml, the problem was gone.
Thanks a lot! Facundo