Saturday, 15 March 2014

Android Google Map classNotFound exception -



Android Google Map classNotFound exception -

basically trying create app displays google map.here code.

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <com.google.android.maps.mapview android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:enabled="true" android:clickable="true" android:apikey="my key goes here" /> </linearlayout>

mainactivity class...

import com.google.android.maps.mapactivity; import android.os.bundle; import android.app.activity; import android.view.menu; public class mainactivity extends mapactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override protected boolean isroutedisplayed() { // todo auto-generated method stub homecoming false; } }

when run it,i next message

06-22 15:54:03.622: e/androidruntime(26187): fatal exception: main 06-22 15:54:03.622: e/androidruntime(26187): java.lang.runtimeexception: unable instantiate activity componentinfo{com.example.maptutorial/com.example.maptutorial.mainactivity}: java.lang.classnotfoundexception: com.example.maptutorial.mainactivity

perhaps might doing wrong in manifest file,and can not see it..

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.maptutorial" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="18" /> <uses-permission android:name="android.permission.internet"/> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.example.maptutorial.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> </application> </manifest>

i think using map api version 1 deprecated. why cant utilize api 2 either fragment or support-fragment (https://developers.google.com/maps/documentation/android/start)

<fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.mapfragment"/>

manifest file

<uses-feature android:glesversion="0x00020000" android:required="true" /> <meta-data android:name="com.google.android.maps.v2.api_key" android:value="aizasyc8qehdhvd3ztxcr0549uqwnm72h0jgomy" />

android exception classnotfoundexception

No comments:

Post a Comment