Search code examples
androidlaunchmapactivity

Cannot launch activity which extends MapActivity


An activity (ShowPos) cannot be launched when it extends MapActivity. If I change to extends Activity, it launches.

It did work earlier, before I copy/pasted the java codes of the project to a new project in a new workspace when suddenly Eclipse inexplicably could no longer find any Android API, and none could be re-imported. Similar things have happened a few times before, it seems ordinary with Eclipse. But copy/paste has always worked before, for a while at least. And now it warns of no such error.

I do have an API-key, which has worked before. maps.jar is now under Google API 2.2 under the project in the project explorer. The editor notes no errors in any file in the project. When launched, LogCat starts with:


 - D dalvikm Calling exit(1)
 - W dalvikm Unable to resolve superclass of Lintrax/three/ShowPos; (35)
 - W dalvikm Link of class 'Lintrax/three/ShowPos;' failed
 - D AndroidRuntime Shutting down VM
 - W dalvikm threadid=1: thread exiting with uncaught exception
   (groupnr)
 - E AndroidRuntime FATAL EXCEPTION: main

My project name is now "intrax.three". Why does it add an "L" to that? The Manifest does contain:


    uses-library android:name="com.google.android.maps"
    uses-permission android:name="android.permission.INTERNET"

(Couldn't paste the Manifest file here)

Thanks for any help about how I can help Eclipse find stuff!


Solution

  • If you have already defined the Internet permission and uses-library

    <uses-library android:name="com.google.android.maps" /> in your manifest.
    

    Also make sure that the project target is set to google APi.

    Third and imp thing is your package level need to be corrected and build the project again without any map.jar library provided explicitly. Only use google APi inbuilt maps.jar and creat new activity that extends the MapActivity (Also do declare in manifest).