Android 谷歌地图 ClassNotFoundException

5

我正在创建我的第一个Google Maps应用程序,但遇到了一些问题,不知道该怎么解决。我收到了ClassNotFoundException的错误提示。虽然我对Android不太熟悉,但这个错误让我感到困惑。

这是我的清单文件。

<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>

以下是我的布局如何使用MapView。我知道我的API密钥是正确的。

    <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" />

最后,这是来自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

编辑:抱歉,清单没有完美复制。是的,已经设置了软件包。我的虚拟设备也设置为目标:Google API(Google Inc.)-API级别17。


1
你在清单文件中设置了相同的包名吗? - AndroidLearner
1
例如:<manifest package="edu.purdue.cs.cs180.safewalk" ...> - dmon
2个回答

1

如果您正在尝试在模拟器中运行它,您需要定义您的 AVD,将目标设置为 Google APIs (Google Inc) - ... 而不是 Android nn - ...

此致敬礼。


0

只需关闭项目并重新打开即可。修复它。

Orz


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接