0

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!

Sagar Hatekar
  • 8,700
  • 14
  • 56
  • 72
Tombola
  • 1,131
  • 5
  • 15
  • 26
  • 1
    You should at least post your code or logcat if you need some help. – April Smith Feb 14 '12 at 18:13
  • I've gotten a new MD5 key with the keytool, and a new API-key from Google. But it was the same as last time. Shouldn't it be a unique one for each project? – Tombola Feb 14 '12 at 18:30

3 Answers3

2

Go to Project -> Preferences -> Android -> Project Build Target and make sure that you created a project that uses the Google APIs

Felipe Conde
  • 2,024
  • 23
  • 26
  • Thank you for reminding me, but yes, for sure I have already done that! I've done this several times now. It usually helps for a while. Last time Eclipse stopped finding any API after I tried to switch from 2.2 to 2.3.3 (with Google API). Now I've copied everything to a new Google API 2.2 project, with which it worked last time. But now it doesn't even launch, despite no errors indicated. – Tombola Feb 14 '12 at 18:24
0

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).

Arpit Garg
  • 8,476
  • 6
  • 34
  • 59
  • should be inside – Tombola Feb 14 '12 at 19:25
  • Continued: That's my mistake. should be outside in the Manifest. I confused the two and didn't see my error no matter how hard I stared. It all works now! Thanks all! – Tombola Feb 14 '12 at 19:27
  • I must emphasize that it is the *PLACEMENT* of the tags in the manifest which is the big problem for beginners like me. I've seen similar problems with similar answers without anyone understanding anything. So next time, emphasize WHERE the tag is in the manifest. – Tombola Feb 14 '12 at 19:30
0

I've followed the MapView tutorial and it works just fine without any errors.

The error in question is a link error where the Dalvik VM is not able to find your class. This means all the suggestions given here (uses-library, internet permission, setting Google APIs as the Build Target) don't even come into the picture yet. Link error means that Android OS is not able to find your class. So, I suggest you try creating a clean project where you create the new Class from Eclipse and then paste the code snippet instead of pasting files.

BTW, the L is used to identify an Object. Reference: Java Identifiers.

Happy Coding!

Sagar Hatekar
  • 8,700
  • 14
  • 56
  • 72
  • Actually, I have already pasted code instead of files into clean new projects. But the problem was that I misplaced the tag in the Manifest. See below. Thank you! – Tombola Feb 14 '12 at 19:44