Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Google Maps ClassNotFoundException

I'm creating my first Google Maps app, but I've run into some trouble and I can't figure out why. I'm getting a ClassNotFoundException. I'm new to Android in general, but this error has me stumped. Here's my manifest.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="edu.purdue.cs.cs180.safewalk"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <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" >
        <uses-library android:name="com.google.android.maps" />
        <activity
            android:name=".RequestActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            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>

And here's how my layout uses the MapView. I know that my API key is correct.

    <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="@string/mapskey" />

Finally, here's the error from the logcat.

    12-03 13:11:25.861: E/AndroidRuntime(940): Caused by: java.lang.ClassNotFoundException: Didn't find class "edu.purdue.cs.cs180.safewalk.RequestActivity" on path: /system/framework/com.google.android.maps.jar:/data/app/edu.purdue.cs.cs180.safewalk-2.apk

Edit: Sorry, the manifest didn't copy over perfectly. Yes, the package has been set. And my virtual device is set with Target: Google APIs (Google Inc.) - API Level 17.

like image 675
Logan Gore Avatar asked Nov 13 '22 16:11

Logan Gore


1 Answers

If you are trying to run it in the emulator, you need to define you AVD with Target set to Google APIs (Google Inc) - ... and not Android nn - ....

Regards.

like image 50
Luis Avatar answered Nov 15 '22 04:11

Luis