10-30-2009 09:29 PM
I am using Eclipse with bb ant tools to build blackberry applications for about 6 months and haven't had any problems until now.
Today when I try to use Graphics.drawtext() in my program eclipse is giving me the error "The type net.rim.device.api.ui.TextMetrics cannot be resolved. It is indirectly referenced from required .class files".
I did some poking around in the net_rim_api.jar file and inside the Graphics class it defines the following functions (decompiled Graphics.class using javap):
public native int drawText(java.lang.String, int, int, int, int, net.rim.device.api.ui.DrawTextParam, net.rim.device.api.ui.TextMetrics);
public native int drawText(java.lang.StringBuffer, int, int, int, int, net.rim.device.api.ui.DrawTextParam, net.rim.device.api.ui.TextMetrics);
public native int drawText(net.rim.device.internal.ui.StringBufferGa
public native int drawText(char, int, int, int, int, net.rim.device.api.ui.DrawTextParam, net.rim.device.api.ui.TextMetrics);
Notice the net.rim.device.api.ui.TextMetrics in each of these functions? It isn't in the Jar file. Googling it shows that it is in the SDK for v5.0.0, and here it says
BlackBerry API 5.0.0"
So I am a little confused. I have completely reinstalled JDE 4.5.0, I also re-downloaded it thinking my installer may have been corrupt - no effect.
I am guessing then that perhaps this isn't really a bug but more of a problem which only shows up when you are using Eclipse? Inside JDE Graphics.drawText has 8 overloaded versions - inside the Graphics.class file there are 13 overloaded versions!
Can anybody enlighten me? For now I think I will just have to put up with eclipse telling me my code has errors, even though RAPC builds it fine.
10-31-2009 06:42 AM
If I recall correctly, this very same error used to pop up in ancient JDEs (e.g., 4.0 or 4.2) years go when the wrong (newer) version of Java compiler was used. Can this be what's happening here?
10-31-2009 06:50 AM
10-31-2009 07:36 AM - edited 10-31-2009 07:37 AM
Not sure whether this will help, but try specifying 1.3 or 1.1 as the target version of the bytecode using the -target switch of javac. Similarly, play around with the -source switch. Best of all, see what switches the JDE v4.5 passes to javac.
10-31-2009 08:06 AM
Is it a specifc drawText call (I mean just one of the overloaded methods) showing you the Eclipse error or do you always get this error irrespective of the drawText method?
10-31-2009 08:12 AM
12-20-2009 12:43 PM
I know this is an older thread but I just ran into the same problem - here's my "fix". I created an empty class with that name/package and stuck it in a jar in eclipse's classpath - problem solved - just make sure you don't accidentally deploy that class - you will get a security violation.