【问题标题】:Using Google Maps in Android - Error code在 Android 中使用 Google 地图 - 错误代码
【发布时间】:2013-06-02 01:14:18
【问题描述】:

我正在尝试学习本教程。 在Android中使用谷歌地图-http://mobiforge.com/developing/story/using-google-maps-android

我做的第一个代码是:

package net.learn2develop.GoogleMaps;

    import com.google.android.maps.MapActivity;
    import com.google.android.maps.MapView;
    import android.os.Bundle;

    public class MapsActivity 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() {
            return false;
        }
    }

我收到很多错误,例如:

1) import.com.google 无法解析。 2) MapActivity 无法解析为类型。

请帮助我。谢谢

好的。我在Mapview in MapActivity Class not found

中找到了解决方案

【问题讨论】:

    标签: java eclipse


    【解决方案1】:

    您正在使用现在无法使用的旧的/已弃用的 API。 您必须使用 Google Maps V2 Api 进行开发。 为此,您需要

    1. Google Play 服务安装在您的 SDK(Read this Post) 中。
    2. 来自 Google API 控制台的 API 密钥。
    3. 如果您要为 android 2.2 (Froyo) 及更高版本进行开发,您需要使用 Supportmapfragment 和 fragmentActivity(Read This Post)。
    4. 如果你想为android 3.0(honeycomb)及以上版本开发你必须使用Mapfragment和Activity(Read This Post)。

    在发布问题之前搜索 SO 论坛,有很多关于同一问题的已解决问题

    【讨论】:

      猜你喜欢
      • 2021-08-16
      • 1970-01-01
      • 1970-01-01
      • 2020-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多