Search code examples
androidandroid-activitymapactivity

how to start a MapActvity from Activity


i'm trying to start a map activity from a normal Activity. But keep getting the error:

10-20 10:47:08.828: ERROR/dalvikvm(1102): Could not find class 'com.xxApp.MapAnalyseActivity', referenced from method com.xxApp.xxAppActivity$1.run
10-20 10:47:11.578: ERROR/AndroidRuntime(1102): java.lang.NoClassDefFoundError: com.xxApp.MapAnalyseActivity

when i try to do:

startActivity(new Intent(xxAppActivity.this, MapAnalyseActivity.class));
xxAppActivity.this.finish();

Here is my manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.xxApp"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".xxAppActivity" android:label="@string/app_name" android:theme="@style/xxTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


     <activity android:label="@string/mapAnalyse" android:name="MapAnalyseActivity" android:configChanges="orientation|keyboardHidden" android:theme="@style/xxTheme">
        <intent-filter>
            <action android:name="com.xxApp.MapAnalyseActivity" />
        </intent-filter>
    </activity>


</application>


Solution

  • Your manifest.xml should look like this

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.xxApp"
      android:versionCode="1"
      android:versionName="1.0">
        <uses-sdk android:minSdkVersion="7" />
        <application android:icon="@drawable/icon" android:label="@string/app_name">
    
            <activity android:name=".xxAppActivity" android:label="@string/app_name" android:theme="@style/xxTheme">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
    
             <activity android:label="@string/mapAnalyse" android:name="MapAnalyseActivity" android:configChanges="orientation|keyboardHidden" android:theme="@style/xxTheme"/>
    
             <uses-library android:name="com.google.android.maps"/>              
        </application>
        <uses-permission android:name="android.permission.INTERNET" />
    </manifest>