I have an application which has 11 different activities. One of these activities is an extension of MapActivity (it is a map for data visualization). To get to this activi
I was having the same issue and tried all the above proposed solutions (except rebuilding the project) with no success. Then I cleaned the project and it was fixed. In Eclipse Project>Clean check your project and select ok.
I update cyber-monk answer because the problem is not that you do not have maps.jar, the problem is that you have conflicting jar (e.g you mix maps.jar with android 4.0). So
Project > Properties > Android
. If that not the case select it and click on apply. This change will modify the target property in the file project.properties and change the included libraries. (e.g with the latest android sdk, you will have: target=Google Inc.:Google APIs:14
)Project > Properties > Java Build Path > Libraries
and ensure that there is no android.jar or maps.jar directly included. You should only have Google Apis with at least maps.jar and android.jar as leaves.One other most probable reason as it turned out was the fact that there were conflicting libs ,so resulting into those ClassLoading issues,it is good to remove the other unneccessary libs. If you have included the google maps Lib as suggested by previous contributors then do remove them,so that your project now looks like the following below.
Another Possible Cause is the package declaration on your manifest .
I had this exact same problem.
I was adding the maps.jar manually in the build path and using android 2.1 as the target. This does not seem to work (not on 2.1 anyway) despite the tutorial i followed saying to do it like this.
How i solved it was:
-Remove the manually added maps.jar then i set my build target to Google APIs 2.1 instead of Android 2.1
I realised afterwards that the maps.jar is automatically included in the "Google" Android libs so was conflicting. :D
The problem is that your MapVis class is likely extending com.google.android.maps.MapActivity. For the system to be able to find this class you need to do two things:
First make sure your project is including the Android maps.jar in your build path. From Eclipse find
Project > Properties > Android
Then select one of the "Google APIs" as appropriate for you app. You can confirm that maps.jar is on your build path by checking:
Project > Properties > Java Build Path > Libraries > Expand "Google Apis"
Second browse to your manifest file and make sure you have the uses-library
snippet nested within the <application>
tags as follows:
<manifest>
...
<application ...>
<uses-library android:name="com.google.android.maps" />
...
</application>
</manifest>
May the force be with you!
John's answer worked for me. It took me forever to come across this solution. A great page for working with the MapActivity is here. It covers most of the problems encountered when working with it, including the solution John had.