NOTE:

NOTE: Of late, I have been getting requests for very trivial problems that many of you are facing in your day-to-day work. This blog is not to solve your "project" problems - surely not a "Support" site.
I just love to share my knowledge in my spare time and would appreciate any questions or feedback on the articles and code I have shared. I also do appreciate thought-provoking questions that would lead me to write more articles and share.
But please do not put your day-to-day trivial problems here. Even if you do, you most probably would not get a response here.
Thanks

Search This Blog

x

Thursday, 2 December 2010

Android Eclipse link Error - New Project

I set up a new environment on my new laptop with Windows7 and jdk1.6.0_21 version. Did the initial setup with eclipse installation, android SDK installation, installing the ADT plugin on eclipse etc. I then imported all the android projects I had created so far. It worked perfectly fine.
Next I created a simple project without any custom stuff, it failed to create with a link error as shown in the image below:

After much trial and error, setting up everything afresh, changing or creating a new workspace, nothing seemed to work. I noticed that the Android package was not visible in the Java build path that you get to see in the project properties. So, finally I found a manual workaround to overcome this problem if you mandatorily want to continue working in the same workspace
Solution: Same workspace:
The manual resolution I found is to make a classpath entry in the .classpath file outside the eclipse environment.
The .classpath file may have such an entry before you edit it:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
     <classpathentry kind="src" path="src"/>
     <classpathentry kind="src" path="gen"/>
     <classpathentry kind="output" path="bin"/>
</classpath>

So add an entry for the android framework to be included as shown below:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
     <classpathentry kind="src" path="src"/>
     <classpathentry kind="src" path="gen"/>
     <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
     <classpathentry kind="output" path="bin"/>
</classpath>

What actually corrupted my workspace, i have not yet figured out. However, while searching on the web for all possible solutions, I came across the announcement on the eclipse forums that Eclipse 3.3 to 3.6 on windows platform is not stable with the JDK version -  jdk1.6.0_21. Hence we need to either roll back to patch 20 or upgrade to 22. I have upgraded and see that eclipse is far more stable now.
Please see this link for more details on the windows and jdk problem mentioned above:
Solution: Different or new workspace:
Just upgrade your JDK to jdk1.6.0_22 and point eclipse to use this as the default JDK. Create a new workspace and you are done. It fixes the problem.
Hope this helps many not to waste time on searching a solution that is not to do with the way you are coding but with the environment set up itself. I had to spend quite a bit of my precious time before figuring this out. 

1 comment: