在 Android Studio 中使用 android-maps-utils [英] Use android-maps-utils in Android Studio

查看:52
本文介绍了在 Android Studio 中使用 android-maps-utils的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Android 项目中通过 Android Studio 或 ADT 使用此库 [1].但它根本不起作用.在 ADT 中,我不知道如何处理 gradle 内容,而在 Android Studio 中,当我尝试导入项目"时,出现错误找不到 com.google.android.gms:play-services:3.1.36.

I am trying to use this library [1] in an Android project either with Android Studio or with ADT. But it doesn't work at all. In ADT I don't know how to handle gradle stuff and in Android Studio, when I try to "Import Project", I get the error "Could not find com.google.android.gms:play-services:3.1.36.

(没有足够的声望来张贴图片,它在带有 xswZ3.jpg 的 imgur 上)

(don't have enough reputation to post picture, it's on imgur with xswZ3.jpg)

我不熟悉 gradle,我对它的作用只有一个模糊的概念,但我只想在我自己的项目中使用类似 BubbleIconFactory f = new BubbleIconFactory(this) 的东西.

I am not familiar with gradle and I only have a vague idea of what it does but all I want is to use something like BubbleIconFactory f = new BubbleIconFactory(this) in my own project.

感谢任何帮助!

[1] https://github.com/googlemaps/android-maps-utils

推荐答案

也许您的问题是需要 buildscript 块之外的 repositories.

Perhaps your problem is needing the repositories outside of the buildscript block.

buildscript 内部的 repositories 用于管理 gradle 依赖本身,我相信.下面是我如何将 google-maps-utils 作为库依赖项解决的问题.希望这会有所帮助.我也包含了我的地图和 support-v4 库.

The repositories internal to the buildscript is for managing the gradle dependency itself, I believe. Here's how I resolved my problem with google-maps-utils as a library dependency. Hopefully this helps. I included my maps and support-v4 libs too.

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.10+'
    }
}

apply plugin: 'android'

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // Support Libraries
    compile 'com.google.android.gms:play-services:4.1.32'
    compile 'com.android.support:support-v4:19.0.1'
    compile 'com.google.maps.android:android-maps-utils:0.3+'
}

这篇关于在 Android Studio 中使用 android-maps-utils的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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