Android Eclipse Classpath - want to add classpath container path but eclipse won't let me

人盡茶涼 提交于 2019-11-28 04:59:44
Shreedhar Kotekar

I had faced the same issue when I imported a sample code downloaded from the internet. I am using android sdk 1.5 with 0.9 ADT plugins. Here is a simpler way to fix the andoid library reference issues

  • Right click on the project which has issues and select properties
  • Select the appropriate Android build (1.1, 1.5 or 1.5 with google api) and say ok
  • Again right click on the project and select "Android Tools > Fix Project Properties"
  • Fix the imports once (if required)
  • Refresh the project and you should be ready to go without any manual editing
Stark

I faced this same problem after importing a project through GIT. The problem was that I didn't have the same target android platform installed, and the build path somehow got corrupted.

The first obvious thing i did was changing the target sdk in the project.properties, but even after cleaning up the project and Android Tools > Fix Project Properties, it didn't help and I was still getting the build error.

My solution after wasting close to 1 hour trying to figure this out?

RESTART ECLIPSE

Everything worked fine after that. Eclipse is pretty fickle. Only through years of experience you'll then understand her well. :)

Had the same problem and it turns out the Android SDK Location was not set which was a really simple fix. Go to Window->Preferences, click on 'Android' on the left hand menu, fill in the location of the Android SDK (e.g. C:\Program Files\Android\android-sdk) and click OK. Everything worked fine for me after that.

Found the answer in this set up guide: http://developer.motorola.com/docstools/library/Installing-Android-Dev-Environment/

Sometimes Eclipse can get a bit funny (technical term) with classpath container resolution. You have a working project in your workspace, so you can rule out plugin installation issues. You could try opening the .classpath file (hidden by default, select the triangle in the top-right of the Package Explorer view, select Filters... and uncheck .* resources) and manually adding the container declaration.

`<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>`

You may then have to close the project and open it again (right-click->Close Project) before Eclipse recognises the change.

You may also find that there is an Android builder and/or nature. If you compare the .project files for the working and non-working versions you may see entries for Android builders/natures. Copying the relevant entries may resolve the issue.

sometimes, eclipse can help you. In Android projects, click right button on the project-> Android Tools -> Fix Project Properties.

It's usefull in class path errors!!

Luck!

I would verify you have the correct version of Java installed as well as the Android SDK. I would recommend installing/reinstalling the ADT plugin in your eclipse, makes it alot easier to create the android project.

http://developer.android.com/sdk/1.5_r2/installing.html

Also. I guess the path of the Android SDK must be setup correctly. This happened when I was overloaded with projects and I decided to create a new workspace copying some existing stuff into it.

Seems that the new workspace requires you to setup these details too once again

Is that setup properly?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!