2016-01-06 147 views
14

我怎樣才能讓PlaceAutocompleteFragment解決?如何解決`PlaceAutocompleteFragment`問題?

嗨,大家好,我試圖使用新PlaceAutocompleteFragment。我嘗試使用以下代碼:

<fragment 
    android:id="@+id/place_autocomplete_fragment" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" 
    /> 

此代碼示例僅爲副本。它是從這個site。但在我的情況下,PlaceAutocompleteFragment尚未解決。我該如何解決這個問題?我認爲解決方案一定非常簡單。不過,我一直在尋找相當一段時間。

回答

48

對於PlaceAutocompleteFragment的用途,我們需要添加一個LIB的gradle中添加 這

編譯 'com.google.android.gms:發揮服務定位:8.4.0'

在你的Android Application.I的gradle這個已經在我的Android Studio經過這一點。 如果您的問題已解決,請讓我知道。

編輯: 它已發散到:

編譯 'com.google.android.gms:發揮服務-地方:9.4.0'

(從評論以下)

+2

這是無處在谷歌文檔。謝謝。 – Matteo

+4

現在它已發散成'編譯「com.google.android.gms:發揮服務-地方:9.4.0'' –

+1

雅,你必須更新,帶「classpath主要應用gradle這個「com.google.gms:谷歌-Services:3.0.0 ''」 –

1

您需要添加一個LIB的gradle中添加此

compile 'com.google.android.gms:play-services-location:10.0.1' 

使用同一版本「10.0.1」,或者你有currenty在這兩種服務的Gradle你什麼。

例子: -

compile 'com.google.android.gms:play-services-maps:10.0.1' 
compile 'com.google.android.gms:play-services-location:10.0.1' 
1

剛剛從 「地方」 到 「地方」

例如

變化

編譯「COM改變gradle這個你的編譯庫。 google.android.gms:播放服務定位: 「yourversion」」

編譯 'com.google.android.gms:發揮服務-地方: 「yourversion」'