简体   繁体   中英

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.

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.

Only close the project and reopen it. Fix it.

Orz

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM