简体   繁体   中英

How to use Google's auto complete places api in Android application

I want to use Google Places API in my android application. I have API Key I got it from Google's API console. I am following the Perform Autocomplete section in this tutorial .

Now the problem I am facing is exactly which jar file I need for this. I have tried with two:

  1. google-api-client-1.6.0-beta.jar

    In this case I am getting exception when creating the object of class where I have implemented these methods and imported the packages of above library

  2. google-http-client-1.6.0-beta.jar

    GoogleHeaders cannot be resolved to a type

If I comment the code where I am setting header to request it does not shows any error but when I execute the code I get the following error:

java.lang.NoClassDefFoundError: com.google.common.base.Preconditions

I have also added all the dependency jars.

There is no need to use a specific client. Just use any library that can make HTTP requests (like Apache HttpClient), then parse the JSON (or XML) that you get back from the Places API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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