Java android MapActivity可以';不能延伸

Java android MapActivity可以';不能延伸,java,android,Java,Android,我遵循这些网站中的所有步骤: 我还下载了play services sdk 但是,我仍然收到一条错误消息: The import com.google.android.maps cannot be resolved 我也无法扩展MapActivity: package com.example.sale; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapView; import com

我遵循这些网站中的所有步骤:

我还下载了play services sdk

但是,我仍然收到一条错误消息:

The import com.google.android.maps cannot be resolved
我也无法扩展MapActivity:

package com.example.sale;

import com.google.android.maps.GeoPoint;  
import com.google.android.maps.MapView; 
import com.google.android.maps.MapActivity;


public class SaleMapActivity extends MapActivity {

}
这是我的manifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.sale"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="10" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <!-- The following two permissions are not required to use
     Google Maps Android API v2, but are recommended. -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <permission
        android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
        <uses-permission android:name="com.example.sale.permission.MAPS_RECEIVE"/>

    <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="com.example.sale.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>


              </activity>

         <!--  Entry for RegisterActivity.class -->
        <activity android:name=".RegisterActivity"
                  android:label="Register New Account"></activity>
        <meta-data android:value="@string/app_id" android:name="com.facebook.sdk.ApplicationId"/>
        <activity android:label="@string/app_name" android:name="com.facebook.LoginActivity"></activity>
        <activity android:name=".ProfileActivity" android:label="Profile page"></activity>

        <meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="AIzaSyDTVRXMTmfe3jZyAlt-87kRgqM8y4TzIto"/>

    </application>

</manifest>

有什么问题?我遵循所有的步骤,在谷歌上读了很多书,但是没有回答。如何解决这个问题?

您混淆了这两种API,您的代码中有一部分来自Google Maps API V1,如:

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

还有更多

还有APIv2的一部分,你想用什么APIv2? 我建议您坚持使用Google Maps API V2,我写了一篇关于如何在应用程序中实现Google map API V2的博客文章,您可以在这里查看:


这相当简单,您不需要下载任何东西
创建新项目时,唯一需要做的是将“Compile with”选项更改为“googleAPIs”。

重复问题有两个映射API:Maps V1和Maps V2。你把两者混淆了。由于“地图V1”现已弃用,请使用“地图V2”。这里记录了Maps V2:如果您访问路径中有
v1/
的URL,则您位于错误的位置。您好,我使用了Maps V2版本,您可以从我的手册中看到。我不明白,那么我需要编写什么导入?它无法识别我的导入?嗨,我遵循了你博客中的所有步骤(我发现我的代码没有变化)…我在逃避什么错误?为了扩展MapActivity,我需要实现哪些更改?MapActivity是Google API V1对象,不能在V2中使用。您的活动应该扩展FragmentActivity,您应该使用SupportMapFragment来显示地图而不是地图视图。此外,这个API中的坐标对象是LatLng而不是GeoPoint。再说一次,@AdirRahamim如果你直接按照博客文章中的所有步骤操作,你将得到google maps API V2。它在博客链接中写到了什么?我应该导入什么?我甚至还没有看到我需要在你的博客中执行碎片活动?在你的博客中,我只能看到xml…如果你真的阅读它,你会看到:“8.现在创建一个扩展自“FragmentActivity”的活动,为该活动创建一个xml布局文件,并将其设置为该活动的内容视图,在布局中写以下内容:”,事实上,当我写这篇文章的时候,我创建了一个地图应用程序,你可以在文章的结尾看到最终的结果。