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:
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
As per importing external .jar files, you need to put in "libs"{.jar files} folder too.
I think the image of Folder structure would help you how to add external jar files. If you do as shown in image then i think your error will be gone.
In addition to upgrading to Java 6, I would suggest removing all external libraries and re-adding them. Eclipse generally has major problems when you upgrade Java or ADT versions (in my case anyway), and the best solution for me has been to wipe everything out and start over.
If removing all dependencies/external libraries and re-adding them doesn't solve your problem I suggest creating a new project, copying over all your assets, then re-adding the google libraries there.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With