android - 找不到 MapActivity 类中的 Mapview

标签 android android-mapview

我在这里看到其他线程有类似的症状,但没有一个答案能解决我的问题。我正在关注 Google map View 教程,http://developer.android.com/resources/tutorials/views/hello-mapview.html并严格按照所有指示,我不断收到此错误 .. java.lang.ClassNotFoundException: com.goodintechnology.maps.Mymap in loader dalvik.system.PathClassLoader[/data/app/com.goodintechnology.maps-1.apk]

我已经多次从头开始,但每次,只要我将 Activity 更改为 MapActivity,就会抛出错误。应用程序目标是 Google API 2.2,模拟器是相同的,启用了 GPS。我试过将 uses-library 语句放在 Applications 语句之前、之后和中,但这并没有改变任何东西。我什至尝试将声明垂直放置在 list 中。所以,经过大约 8 个小时的处理,我把它交给了你们所有人。这是代码:

AndroidManifest.xml

<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".Mymap"
              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>

和布局main.xml

<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="My key that was generated on google is here. trust me"
/>
</LinearLayout>

和 Mymap 类

package com.goodintechnology.maps;
import com.google.android.maps.MapActivity;
import android.os.Bundle;

public class Mymap extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}

@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}
}

如前所述,这完全来自 Google map View 教程。

最佳答案

<uses-library android:name="com.google.android.maps" />

必须在

你说你试过了,但你目前的方式,它不会有任何机会,所以先改变它。

关于android - 找不到 MapActivity 类中的 Mapview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5214091/

相关文章:

java - 如何防止键盘和菜单同时显示?

java - Kotlin 数据类中的私有(private)成员变量

java - 打开街道 map (osmdroid) 在 PC 中显示灰色瓷砖而不是 map

android - 如何在 mapview 上固定项目的 onTap 区域?

android - 将 Google map 添加到 RecyclerView

android map View 不工作

Android:为什么要使用 XMLReader?

java - Mongodb Java cmd find().pretty() 不工作

java - 根据数字程序设置GridView的ImageVIew

Android自定义控件显示 map 瓦片