Alex Rivera | Logout

AndroidRuntime: The import com.google.api.client cannot be resolved

Asked 2012-03-17T01:00:18.947
10

Has anybody else seen this problem where imports can't be resolved at Andriod runtime?

I am trying to build the calendar android sample by following the instructions: http://samples.google-api-java-client.googlecode.com/hg/calendar-android-sample/instructions.html?r=default

My build path contains the following:

BuildPath

It builds OK in Eclipse with no problems/warnings. However when I launch it on my HTC (android 2.3.3) but it "stops unexpectedly" and in LogCat it says:

E/AndroidRuntime(8170): java.lang.Error: Unresolved compilation problems: 
E/AndroidRuntime(8170):     The import com.google.api.client cannot be resolved
Followed by many other google-api import resolution failures.

And when run under debug: the code window shows it stopping at the first import

package com.google.api.services.samples.calendar.android;
import com.google.api.client.extensions.android2.AndroidHttp; << stops here

I'm not sure if the import failures are specific to the google API stuff or a more widespread issue with imports.

I guess that somehow Maven is not linking these libraries into the APK. It surprises me that this issue does not get flagged as a problem at build time where I might have better luck in fixing them.

I suspect I have damaged my Maven installation somehow and possibly even Eclipse also. My next step is to wipe them completely and start with fresh installs.

Has anybody seen this problem where imports can't be resolved at runtime? Or maybe someone has some advice on areas of investigation that I might pursue? Or any relevant experiences that you have would be welcome.

Kind Regards, Peter

Edit
Report

1 Answer

1

The standard google http-client comes with its dependencies. It means you have to import those libraries too.

Here is the link from where you can import android-google-calender-example.

This project is having all the required libraries imported.

Hope this will help you to get the solution.

answered 2012-09-21T13:28:35.717

Your Answer