Reputation: 150
I'm new to the Map View implementation in Android. I'm trying to launch a new Activity (on a button click) that will contain the google maps. I seem to be doing everything mentioned in http://developer.android.com/guide/tutorials/views/hello-mapview.html. However i'm getting the following error:-
04-18 12:11:11.332: E/AndroidRuntime(629): FATAL EXCEPTION: main
04-18 12:11:11.332: E/AndroidRuntime(629): java.lang.IllegalStateException: Could not execute method of the activity
04-18 12:11:11.332: E/AndroidRuntime(629): at android.view.View$1.onClick(View.java:2144)
04-18 12:11:11.332: E/AndroidRuntime(629): at android.view.View.performClick(View.java:2485)
04-18 12:11:11.332: E/AndroidRuntime(629): at android.view.View$PerformClick.run(View.java:9080)
04-18 12:11:11.332: E/AndroidRuntime(629): at android.os.Handler.handleCallback(Handler.java:587)
04-18 12:11:11.332: E/AndroidRuntime(629): at android.os.Handler.dispatchMessage(Handler.java:92)
04-18 12:11:11.332: E/AndroidRuntime(629): at android.os.Looper.loop(Looper.java:130)
04-18 12:11:11.332: E/AndroidRuntime(629): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-18 12:11:11.332: E/AndroidRuntime(629): at java.lang.reflect.Method.invokeNative(Native Method)
04-18 12:11:11.332: E/AndroidRuntime(629): at java.lang.reflect.Method.invoke(Method.java:507)
04-18 12:11:11.332: E/AndroidRuntime(629): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-18 12:11:11.332: E/AndroidRuntime(629): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-18 12:11:11.332: E/AndroidRuntime(629): at dalvik.system.NativeStart.main(Native Method)
04-18 12:11:11.332: E/AndroidRuntime(629): Caused by: java.lang.reflect.InvocationTargetException
04-18 12:11:11.332: E/AndroidRuntime(629): at java.lang.reflect.Method.invokeNative(Native Method)
04-18 12:11:11.332: E/AndroidRuntime(629): at java.lang.reflect.Method.invoke(Method.java:507)
04-18 12:11:11.332: E/AndroidRuntime(629): at android.view.View$1.onClick(View.java:2139)
04-18 12:11:11.332: E/AndroidRuntime(629): ... 11 more
04-18 12:11:11.332: E/AndroidRuntime(629): Caused by: java.lang.NoClassDefFoundError: org.sam.LocationActivity
04-18 12:11:11.332: E/AndroidRuntime(629): at org.sam.SelfDefActivity.showLocator(SelfDefActivity.java:16)
04-18 12:11:11.332: E/AndroidRuntime(629): ... 14 more
This is what method showLocator looks like:-
public void showLocator(View view) {
Intent i = new Intent(SelfDefActivity.this, LocationActivity.class);
final int result=1;
startActivityForResult(i, result);
finish();
}
This is what my manifest looks like:--
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sam"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name=".SelfDefActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LocationActivity"
android:label="@string/location_activity" >
<uses-library android:name="com.google.android.maps" />
</activity>
</application>
</manifest>
Could anyone tell me where i'm going wrong?
Upvotes: 0
Views: 1175
Reputation: 7165
Add full path for your activity in manifest file
like android:name="your package name.LocationActivity"
As your activity name suggest you are checking location your should add permission for that also as below
Your manifest should look like
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sam"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name=".SelfDefActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LocationActivity"
android:label="@string/location_activity" >
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
Upvotes: 9
Reputation: 1427
you tri this type
</application>
<activity
......
.....
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
Upvotes: 0