Thursday, January 14, 2010

MapActivity cannot be resolved to a type

When I first working on with MapActivity, I got above error. I kept press Ctrl+Shift+O. However, the type just wouldn’t resolve. Finally I found the answer on the Internet. You need to change the build target to “Google API”
Right click on the project. Go to “Properties”. Change the “Build Target” from “Android 1.x to Google APIs 1.x”
image

26 comments:

  1. Thanks for this post. I was going crazy trying to find why "MapActivity cannot be resolved to a type". After reading your post, I found the Google APIs for Android, installed them, and then set the target as per your screenshot, and all the compile errors went away.

    ReplyDelete
  2. Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks !

    ReplyDelete
  3. Hey all! I had the same issue even though I had started a new project using Google API right from the get-go. The fix was to make sure to import the com.google.android.maps.MapActivity class. So in the example, you should have something like this:

    import android.app.Activity;
    import android.os.Bundle;
    import com.google.android.maps.MapActivity;

    That fixed it for me!

    ReplyDelete
  4. Hey thanks! I'm very new to android and java, and this helped me out immensly!

    ReplyDelete
  5. thanks Very Much for your post,,,m really thanks so much

    ReplyDelete
  6. Thank you so much for t post.. MapActivity thing made me mad for sometime ...... ;)

    ReplyDelete
  7. Thank you so much. This worked. Why doesn't the ADT Plugin give some hints for stuff like this? Billions in profit, but not enough staff to make development a little less frustrating?

    ReplyDelete
  8. Thank you so much.
    This info was too much helpful..

    ReplyDelete
  9. I do not have Google APIs under Project Build Target. Any idea what to do ?

    ReplyDelete
  10. You probably haven't installed the Google APIs. Check out http://code.google.com/android/add-ons/google-apis/

    ReplyDelete
  11. I Love You Thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanks

    ReplyDelete
  12. Thank you so much for your help!! This is so helpful! (:

    ReplyDelete
  13. Thank you so much!!!!!!!!!!!!!!!! great........................

    ReplyDelete
  14. Thankyou so much for this important post.. :-)

    ReplyDelete
  15. That's great yar! A bunch of thanks to dear

    ReplyDelete
  16. Grand merci mon grand tu m'a sauvé la vie j’étais au point de mourir!
    merci!merci!merci!merci!merci!merci!merci!merci!merci!merci!merci!merci!

    ReplyDelete