Mapview in class MapActivity not found

I saw other topics here with similar symptoms, but none of the answers resolved my issue. I follow the google map viewing guide, http://developer.android.com/resources/tutorials/views/hello-mapview.html and following all the directions exactly, I keep getting this error. Java.lang.ClassNotFoundException: com.goodintechnology.maps.Mymap in the dalvik.system.PathClassLoader loader [/data/app/com.goodintechnology.maps-1.apk]

I started from scratch many times, but every time I change Activity to MapActivity, an error occurs. The purpose of the application is Google API 2.2, and the emulator is the same with GPS enabled. I tried to put the uses-library statement before, after, and in the Application, but that didn't change anything. I even tried to put the statement vertically in the manifest. So, after about 8 hours, messing around with this, I passed it on to all of you. Here is the code:

AndroidManifest.xml 

 <uses-library android:name="com.google.android.maps" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".Mymap" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> 

and layout main.xml

 <com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey="My key that was generated on google is here. trust me" /> </LinearLayout> 

And the Mymap class

 package com.goodintechnology.maps; import com.google.android.maps.MapActivity; import android.os.Bundle; public class Mymap extends MapActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } } 

As already mentioned, all this is straight from the Google Map View tutorial.

+6
android android-mapview
source share
5 answers
 <uses-library android:name="com.google.android.maps" /> 

should be inside <application> </ l; / & application of GT;

You said you tried it, but as you currently have it, it won’t work by accident, so change it first.

+25
source share

It seems that maps.jar is not in your project folder.

First of all, put the following line as a child of the application in the manifest file

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

After that, right-click on the project folder -> Properties -> Android -> In Project Build Target, check if the checkbox for Google API only has been checked. if not check. this will add maps.jar to your project, and then your project will understand what MapActivity .. :)

+15
source share

Have you downloaded the Google API add-in for the SDK version you are using?

Google APIs are not packaged with a standard SDK. You must download them using the AVD Manager.

Edit - he says to add <uses-library ... /> as a child <application> .

This means that it is placed on the line after the <application> , but before </application> .

+4
source share

I had the same problem until I created a new Android virtual device.

Make sure you create an Android virtual device that also has the Google API. Just having an API in the SDK and setting a target for the version with Google APIs turned on is not enough, you also need to make sure that the Google APIs from the Android SDK are installed on your virtual emulator device.

0
source share

I fixed this error by installing eclipse in a different place and installing Android plugins (ADT). It worked for me.

0
source share

All Articles