2016-06-27 1 views
11

PlacePicker을 사용하여 위치 정보를 캡처하는 간단한 프로그램을 작성하려고합니다. 그러나 제 프로젝트는 필요한 수입을 해결할 수 없습니다. Google 지역 정보 PlacePicker를 Android 프로젝트에 가져올 수 없습니다.

build.gradle

:

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.3.0' 
    compile 'com.google.android.gms:play-services-location:9.2.0' 
    compile 'com.google.android.gms:play-services-maps:9.2.0' 
} 

활동 :

import com.google.android.gms.location.places.Place; // "Place" is not resolved 
import com.google.android.gms.location.places.ui.PlacePicker; // "ui" is not resolved 
import com.google.android.gms.maps.model.LatLng; 

LatLng 가져 오기가 작동하는 것 같다,하지만 다른 두. 전체 com.google.android.gms:play-services:9.2.0 API를 가져 오면 전체 프로젝트가 올바르게 실행되지만 불필요한 라이브러리를 줄이기 위해 특정 API 호출을 사용하려고합니다.

+0

을 답이야? 어쨌든 전체지도 패키지를 가져 오지 않습니까? –

+0

@ cricket_007 - 내 초기 질문에 허위 설명이있는 것 같습니다. 내가 필요로하지 않는 엄청난 도서관의 초과 인 전체 Google Play 서비스 패키지 (예 :지도, 위치, 인증, 신원 확인, 피트니스 등)를 가져온 경우에만 작동한다고합니다. 나는 그 질문을 편집 할 것이다. – Fawfulcopter

답변

45

9.2.0 API는 location에 더 이상 위치하지 않습니다. 이들은 이제 자신의 places 종속성에 있습니다. 이 문제를 해결하려면 build.gradle에 추가해야합니다.

compile 'com.google.android.gms:play-services-places:9.2.0'

당신이 "전체 프로젝트가 잘 실행"무엇을 의미합니까 here

+3

정말 고마워요! 분명히 [공식 웹 사이트 ...] (https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project)에서 분명하지 않았습니다. Google-fu도 나를 실망 시켰으므로 이전 질문 참조에 대해 감사드립니다. . – Fawfulcopter

+0

대단하군요. 감사. –

+0

고마워, 그것은 작동한다 : –

관련 문제