This is a very
I managed to find the incriminated line in the Compiler code, it is not ratio=min(11/w,11/h)
but in fact ratio=min(ll/w,ll/h)
can you spot the difference??
This line is in the function GrSaveIcons()
whose goal is to resize the app icon and save it to the different res/drawable-* folders of the project.
This code is a very small place (~10 lines) where I open graphic (GR) mode, do the resize operations, then close GR and continue on with HTML mode...
The Compiler runs 99,5% of the time in HTML mode, this is the only place I use the GR mode.
As Gika pointed out, the error thrown shows either w
are null (equal to zero). I get w
from the following command: Gr.Bitmap.Size original, w, h
where 'original' is the pointer to the picture you chose for icon, loaded thanks to Gr.Bitmap.Load original, src_img$
Most probable cause is that Gr.Bitmap.Size returns 0x0 as the picture size.
And that's where it becomes very
A look at your video gives us the answer. Most interesting info is in the sum-up screen, just before hitting "COMPILE !":
BASIC! Compiler wrote:
App icon: TimeTable.ico
It may seem obvious for a newcomer to use a ".ico" as a source for an Android app "icon" but in the Android world it is not
What Android calls "icon" are in fact PNGs. The Compiler goes around that by transforming any input image to the PNG format, as well as doing the resizing.
I was aware of users using Jpegs or Bmps or even Gifs as input for icon, I tested all these cases, but it is the first time I see someone taking a .ico as source for icon
Ok so why is there an error in the Compiler?
I first thought that when the image was in an unrecognized format and could not be loaded (pointer returned by Gr.Bitmap.Load of -1) then Gr.Bitmap.Size would return 0x0, but I was wrong. A little search in Run.java
showed me in this case (pointer of -1) a runtime error is thrown.
So what's amazing is that the image could be loaded by Gr.Bitmap.Load but then its size is genuinely returned as 0x0.
So here we may have found a BASIC! limitation (I would not say bug): a .ico is known to contain several images of several dimensions.
Maybe the code for Gr.Bitmap.Size does not handle that and returns 0x0.
Further search shows *.ico are not supposed to be supported by Android
What's funny though is that the Compiler doesn't complain until resizing time. You can see your .ico in the list of images, you can select it, the Compiler even shows the correct image size in the "App name+icon" screen! That is because we are working in HTML mode
In HTML mode, the routines used are not Android ones (GR mode uses Android routines) and a .ico is well recognized...
Now, knowing all that, what should be our course of action?
Should the Compiler forbids to use .ico as source of images? Should I remove them from the list of selectable images?