机器人工作室0.2应用程序,使用谷歌地图 - 摇篮修改摇篮、机器人、应用程序、工作室

2023-09-07 08:35:20 作者:江船夜雨听笛声

我开发一个应用程序在Android中的工作室。我想用谷歌地图的API,但我不能使用UI配置的项目设置。我尝试了一些不同的指令添加地图,但没有奏效。我要修改某种方式build.gradle文件?你能告诉我怎么样?是否有人有经验吗?

I'm developing an App in Android studio. And I want use a Google maps API, but I can't use UI to configure project settings. I tried some different instruction to add maps, but it didn't work. I have to modify somehow build.gradle file? Can you tell me how? Does someone have experience with that?

感谢每一个建议。

推荐答案

如果您是在0.2就意味着你已经谷歌库和Android库安装(从Android SDK中:终端$ Android SDK中)。

If you are on 0.2 it means that you already have Google Repository and Android Repository installed(from Android SDK: terminal$ android sdk).

他们中的一个,有谷歌Play业务。 这里是一个充满build.gradle为你的模块:

One of them, has the Google Play services. Here is a full build.gradle for your module:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

dependencies {
    compile 'com.google.android.gms:play-services:3.1.36'
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 16
    }
}

请注意,播放服务如何(容易)可以被包括在内。

Notice how(easily) the play services can be included.

另外摇篮版本是0.5。+所以可以自动更新!

Also gradle version is 0.5.+ so it can be auto updated!

还有另外一个很重要的事情,这浪费了我很多时间是最小的SDK版本! 它必须是8或以上,,因为谷歌播放服务是不支持更低的版本!

Also another VERY important thing, that wasted me a lot of time is the minimum sdk version! It must be 8 or above, since google play services aren't supported for lower versions!