Location API & Class

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

Location API & Class

Postby blundell » Tue Jun 24, 2008 10:44 am

Hey guys trying to create a GPS application that tracks your movement as you walk, i've successfully created this as a free standing midlet, however when i'm now trying to port it into another one of my midlets i'm getting this error:

java.lang.NoClassDefFoundError: Expected an initialized class

I believe its coming from the line

Code: Select all
try {
            if(provider == null) {
               Criteria crit = new Criteria();  //HERE java.lang.NoClassDefFoundError: Expected an initialized class
               provider = LocationProvider.getInstance(crit);
               provider.setLocationListener(this, -1, -1, -1);      
            }
          }
         catch (LocationException e) {
            e.printStackTrace();
            provider = null;
          }


I found an old forum post sayin it was something to do with the the lapi.jar file and a class path problem?
http://www.velocityreviews.com/forums/t142389-cannot-create-an-instance-of-locationcriteria-class-lapijar-midp-20-j2me.html

I'm using eclipse dev, any ideas?

Please reply in the most lamens terms you can, I dont want to keep saying huh?! :oops:

thanks for your time and effort! just ask if you need more info
blundell
 
Posts: 3
Joined: Tue Jun 24, 2008 10:38 am

Re: Location API & Class

Postby blundell » Wed Jun 25, 2008 11:18 am

bump :oops:
blundell
 
Posts: 3
Joined: Tue Jun 24, 2008 10:38 am

Re: Location API & Class

Postby DevelopmentTeam » Thu Jun 26, 2008 4:21 am

1) If you are testing it on emulator, you have to check if the emulator version supports location API and check if you have added the library in the midlet properties.
2) If you are testing the application on real device, do check if the device has support to JSR-179.

These are the 2 probable issues from what I understand, once we make sure both these are not the problem, lets try to dig further. ;)
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: Location API & Class

Postby blundell » Fri Jun 27, 2008 9:09 am

Hey my man thanks for the heads up! I had already checked my emulator twice!!! but since ur reply i checked again, an eureka!! Sony erikson v.7 doesnt support location api but verison 8.0+ does et voila, its working :-) thanks
blundell
 
Posts: 3
Joined: Tue Jun 24, 2008 10:38 am

Re: Location API & Class

Postby DevelopmentTeam » Sat Jun 28, 2008 4:08 am

Ah, nice that you posted the info here. Thanks and keep working... Happy coding...
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India


Return to J2ME Games

Who is online

Users browsing this forum: No registered users and 2 guests

cron