2015-10-20 64 views
0

我想導入這些庫,但它們給我一個錯誤,說「無法解析符號'android'」。我不知道爲什麼我不能導入它們。無法在android studio中導入android庫

import com.google.android.gms.common.ConnectionResult; 
import com.google.android.gms.common.api.GoogleApiClient; 
import com.google.android.gms.location.LocationListener; 
import com.google.android.gms.location.LocationRequest; 
import com.google.android.gms.location.LocationServices; 

我想在我的應用程序中使用GPS /位置服務,我有最新的android studio版本。有誰知道我爲什麼得到這個錯誤。

謝謝。

+3

的可能的複製[Android的進口com.google無法解析](http://stackoverflow.com/questions/17164736/android-the- import-com-google-無法解析) –

回答

1

這聽起來像是你錯過了setting up Google Play Services的第一步,它將依賴添加到你的build.gradle。

定位服務,你需要以下條件:

dependencies { 
    compile 'com.google.android.gms:play-services-maps:8.1.0' 
} 
+0

是的,我沒有通過在build.gradle文件中添加依賴關係來設置Google Play服務。現在我的代碼工作正常。謝謝。 –

相關問題