Problem with splashscreen, cordova android, resource generation


#1

There are many related posts on the Internet, but all are over 12 months old and provided “solutions” are related to package version changes.

The problem occurs on xxxhdpi devices with the following error:

Fatal Exception: java.lang.RuntimeException: Canvas: trying to draw too large(XXXXXXXXXXXXXbytes) bitmap.

At last I pinpointed it in this “bug” report:
https://issues.apache.org/jira/browse/CB-13238

I played with many cordova-android versions etc fell back a lot… A couple of months ago there was no problem. I re-build a new development machine, so it must be introduced in between (probably not the old bugs).

This is the environment:

>ionic info

cli packages: (C:\Users\xxx\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.9.4
    npm               : 5.6.0
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\DEV\Android\sdk

Misc:

    backend : pro

I spent much time, at last I overcame it by resizing the resources/android/splash/drawable-*.png images to their 1/3th size and converting them to PNG-8. I keep a copy of the smaller ones and replace any newly generated ones. Of course this is a sub-optimal solution…

During build, there is only one screen.png file in the package, under res/drawable-mdpi-v4 folder, with size 1280x1920 px. So the files are not copied in correct directories. I don’t know the faulting module…

Are any of you aware of this problem? Do you know the solution?


#2

i’m suffering from same problem if it’s solved out then tell me how can i managed.


#3

It looks like you are suffering from Out of Memory error. Can you try to reduce the quality of splash screen image and try to generate again?


#4

Yes, I kinda overcame it by reducing the image size. The problem was apparent on Samsung Galaxy S7/S8 and Note 8 devices where the screen size was higher.

As indicated above in my original post my only solution is hand copy/reduce/replace the generated single image. BUT, this time when I use a tablet the image looks awful…

I’ll look into this again in my next release, perhaps a bug got fixed…

The “solution” from my original post:

at last I overcame it by resizing the resources/android/splash/drawable-*.png images to their 1/3th size and converting them to PNG-8. I keep a copy of the smaller ones and replace any newly generated ones. Of course this is a sub-optimal solution…

During build, there is only one screen.png file in the package, under res/drawable-mdpi-v4 folder, with size 1280x1920 px. So the files are not copied in correct directories. I don’t know the faulting module…