Chandrapal Yadav
Chandrapal Yadav

Reputation: 287

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.

Upvotes: 2

Views: 1554

Answers (1)

Chris Broadfoot
Chris Broadfoot

Reputation: 5112

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.

Upvotes: 1

Related Questions