简体   繁体   English

在android项目中使用谷歌地方选择器

[英]Using google Place picker in android project

I am trying to learn Google's place picker 我正在尝试学习 谷歌的地方选择器

  1. I have used the sample project from here 我从这里使用了示例项目
  2. I have linked playservices library for the sample project 我已经为示例项目链接了playservices库
  3. Resolved all the dependencies 解决了所有依赖项

Problem: 问题:

Some depedencies r not resolved ther are, 一些依赖性没有得到解决,

import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlacePicker;

Question: 题:

  1. How to solve this 怎么解决这个问题
  2. Should I need to add any other project references 我是否需要添加任何其他项目引用

follow this way : 按照这种方式:

  1. Open the build.gradle file inside your application module directory. 打开应用程序模块目录中的build.gradle文件。
  2. Add a new build rule under dependencies for the latest version of play-services. 在依赖项下为最新版本的play-services添加新的构建规则。

For example: 例如:

    apply plugin: 'com.android.application'
    ...

    dependencies {
        compile 'com.android.support:appcompat-v7:21.0.3'
        compile 'com.google.android.gms:play-services:7.0.0'
    }
  1. Be sure you update this version number each time Google Play services is updated. 每次更新Google Play服务时,请务必更新此版本号。

  2. Save the changes and click Sync Project with Gradle Files in the toolbar. 保存更改,然后单击工具栏中的“使用Gradle文件同步项目”。

Answering because I had te same problem. 回答因为我有同样的问题。

I needed to add 'com.google.android.gms:play-services-places to my project. 我需要在项目中添加'com.google.android.gms:play-services-places

in the app's build.gradle I added 在应用程序的build.gradle我添加了

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM