Why eclipse can not resolve com.google.android.gms.location.ActivityRecognitionClient?

682 Views Asked by At
  1. I want to use google ActivityRecognition service in my android application.
  2. I've install google play services from SDK manager and add google_play_services_lib project to my project by import option and hitting "copy project to your workspace" checkbox.
  3. I'v been wrote a code according to this link: Android Activity Recognition not working with Nexus 5
  4. My import list is as bellow:

    import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.widget.Toast;

    import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesClient; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.location.ActivityRecognitionClient;

    public class MainActivity extends FragmentActivity implements GooglePlayServicesClient.ConnectionCallbacks,GooglePlayServicesClient.OnConnectionFailedListener {

  5. My android project can resolve all import excepting com.google.android.gms.location.ActivityRecognitionClient!!!!

  6. I copied sample activityRecognition project from developer.android.com and open it from my eclipse but there is the same problem with ActivityRecognitionClient!!!
  7. I found a similar problem here: Imported Project in Android Studio can't resolve ActivityRecognnitionClient but not helpful for me.
1

There are 1 best solutions below

0
On

I've add the bellow 3 jar files into the libs directory of my project and the problem is solved!

  • sdk/tools/lib/httpclient-4.1.1.jar
  • sdk/tools/lib/httpcore-4.1.jar
  • sdk/tools/lib/httpmime-4.1.jar