java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment" -
i have checked many blogs fixing it's not working.
my main_activity.xml:
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#12ffff" android:orientation="horizontal" > </linearlayout> <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.mapfragment" android:layout_width="match_parent" android:layout_height="400dp" /> </framelayout> i added google_play_services_lib project.
this mainactivty.java
import android.app.activity; import android.os.bundle; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.marker; import com.google.android.gms.maps.model.markeroptions; public class mainactivity extends activity { private googlemap map; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); gpstracker mgpstracker = new gpstracker(this); if(mgpstracker.isgpsenabled){ latlng current_location = new latlng(mgpstracker.getlatitude(), mgpstracker.getlongitude()); map = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.map)).getmap(); marker hamburg = map.addmarker(new markeroptions().position(current_location).title("you")); map.movecamera(cameraupdatefactory.newlatlngzoom(current_location, 15)); map.animatecamera(cameraupdatefactory.zoomto(10), 2000, null); } } } manifest.xml:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my package name" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="11" android:targetsdkversion="22" /> <permission android:name="my package name.permission.maps_receive" android:protectionlevel="signature" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <uses-permission android:name="my package name.permission.maps_receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="my package name.mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <meta-data android:name="com.google.android.maps.v2.api_key" android:value="aizasybrpl30vkfxrstraixkxlltf8n8gykrceo" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application> </manifest> please tell me mistake did here.
Comments
Post a Comment