MapActivity找不到。 Android的工作室0.5.1 [英] MapActivity could not be found. Android Studio 0.5.1

查看:287
本文介绍了MapActivity找不到。 Android的工作室0.5.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设立在Android的谷歌地图V2。我使用使用这个链接添加依赖新的技术。 Android的工作室与谷歌播放服务

它没有同步,清洁工程后好和改造项目。不过,我找不到MapActivity。似乎是什么问题?

的build.gradle

 应用插件:'机器人'安卓{
    compileSdkVersion 19
    buildToolsVersion19.0.3    defaultConfig {
        8的minSdkVersion
        targetSdkVersion 19
        版本code 1
        的versionName1.0
    }
    buildTypes {
        发布 {
            runProguard假
            proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard的-rules.txt
        }
    }
}依赖{
    编译com.android.support:appcompat-v7:+
    编译文件树(导演:'库',包括:['的* .jar'])
    编译com.google.android.gms:播放服务:4.2.42
}


解决方案

MapActivity 是谷歌地图Android版的一部分 V1 API也就是现在德precated。

使用谷歌Play服务库将使用谷歌地图API的Andr​​oid的 V2 ,然后 MapActivity 不可用了。您需要使用 MapFragment

您可以看到如何使用 MapFragment 中的官方文档

I am setting up google map v2 in Android. I am using the new technique on adding dependency using this link."Android Studio with Google Play Services"

It did nice after synchronization, clean project and rebuild project. However I could not find the MapActivity. What seems to be the problem?

Build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:4.2.42'
}

解决方案

MapActivity was part of the Google Maps Android v1 API which is now deprecated.

Using the Google Play Services library you will use the Google Maps Android API v2 and then MapActivity is not available anymore. You need to use the MapFragment.

You can see an introduction on how to use the MapFragment in the official documentation.

这篇关于MapActivity找不到。 Android的工作室0.5.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆