Invalid Resource Specified on dc.drawBitmap

Former Member
Former Member
I have a code like this:

class TestView extends Ui.View
{
var bitmap;
function initialize()
{
View.initialize();
bitmap = Ui.loadResource(Rez.Drawables.id_icon);
}

function onUpdate(dc)
{
...
if (bitmap != null) {
dc.drawBitmap( 20, 20, bitmap);
}
}



Compile it with SDK 2.1.4 and 2.1.3, then running in emulator gives me:
Failed invoking <symbol>
Invalid Resource Specified


id_icon specified in resources.xml
<resources>
<bitmap id="id_icon" filename="images/icon.png" dithering="none"></bitmap>
...
</resources>


Any idea what's I'm doing wrong?
  • Try terminating the bitmap element like this...

    <bitmap id="id_icon" filename="images/icon.png" dithering="none" />


    You might also put the bitmap element into a <drawables> element like this...

    <resources>
    <drawables>
    <bitmap id="id_icon" filename="images/icon.png" dithering="none" />
    </drawables>
    </resources>


    Let me know if that works.
  • Former Member
    Former Member
    Tried both - same result.
    As I can see resource correctly found and loaded (Ui.loadResource returns non-null value), but then error happens while drawing the bitmap.
    Also I've tried to use different images (1-16 colors) - same result.

    May be the problem is the way I build it?

    C:\tools\connectiq-sdk-win-2.1.4\bin\monkeyc.bat -o app.prg -m manifest.xml -y developer_key.der -z resources\resources.xml MyApp.mc
  • Former Member
    Former Member
    Solved adding param -p with path to projectInfo.xml in SDK bin dir.
  • Failed invoking <symbol>
    Invalid Resource Specified


    Actually this is caused by omitting: -d,--device arg.


    When compiling resources like bitmap, you must choose some device - this will work:
    monkeyc  -y dev_key.der  -o app.prg  -f app\monkey.jungle  -d <device_name>