2

So every once in a while I will add an Android project to my eclipse workspace and link it to libraries in my workspace. For exmaple, I just imported a project via the git import that requires the appcompat_v7 library. The appcompat_v7 library is being used by a number of projects in my workspace successfully. However, when I attempt to link my imported project to the library it fails.

I attempt to add the library like so: Right click project -> Properties -> Android -> Add -> Select and add appcompat_v7. It will show a green check, I click apply, close the window, and clean my project. Like so:

Library List

Then you can see, it appears to be successful

Seems Successful

However, I will open the properties window again and the library now has a red x next to it's absolute file path (D:\Workspace\android\appcompat_v7) where it should have an relative path (../../appcompat_v7) like it does for the projects that it works with. The slashes also reverse (not sure if this is significant).

But it fails

It is like what is going on here: Eclipse will not recognize project as library (ActionBarSherlock/ViewPagerIndicator)

But I can't seem to do anything to get it to work, and it doesn't seem consistent. Some imported projects can be linked to the library fine, some can't. I can restart, refresh, relocate files, duplicate files in different folders, reimport libraries, manually changing the paths in project.properties to relative, etc. Nothing seems to work.

I also noticed that my project.properties file isn't called just "project.properties", but is called " > project.properties". Not sure what that means.

This is a pretty big issue as it literally keeps me from being able to work with some projects. What might be happening? Again, attaching the library is successful 90% of the time, but when it doesn't it is a huge headache.

Community
  • 1
  • 1
zgc7009
  • 3,371
  • 5
  • 22
  • 34
  • Are you using any symbolic links? I had this problem before... and those were the culprit – Gak2 Apr 14 '14 at 20:23
  • Just a small point D:\Workspace\android\appcompat_v7 is an absolute path whereas ../../appcompat_v7 is the relative path – NickT Apr 14 '14 at 20:26
  • @Gak2 not that I am aware of. All of my folders are contained locally in my workspace so I don't know why it would. Is there a good way to check that I am unaware of? – zgc7009 Apr 14 '14 at 20:29
  • @NickT Doh, brain fart. Fixed it :P – zgc7009 Apr 14 '14 at 20:29
  • @zgc7009 Well, if you didn't create a symlink directory then I doubt one exists, but check anyway that ../../appcompat_v7 is not a symlink directory (just check its properties in windows explorer or something), otherwise I have no idea – Gak2 Apr 14 '14 at 20:42
  • @Gak2 That is what I assumed, and that is how I checked. I just didn't know if Windows might be have created something in the background or was masking the symlink or something. – zgc7009 Apr 14 '14 at 20:44

2 Answers2

0

Your Project and the Library you are importing, both should be in the same workspace. So when you are importing appcompat_v7 library project, just tick on the checkbox "Copy projects into workspace" . Now add this library into your project, and you wont get any red 'x' button.

Bhavit S. Sengar
  • 8,794
  • 6
  • 24
  • 34
  • I did that, and it still happens and does happen randomly which is why it is weird. Both of them are in the same workspace, I can check them and have checked their links to make sure they aren't symbolic as commented above. Thank you for your response though – zgc7009 Apr 15 '14 at 12:57
0

I ended up just changing my git repository location to a folder called GitRepository that I put in my workspace. Instead of importing my project from it's git repository I simply cloned the project into the Git repository in my workspace and it seemed to work.

I feel as though there might have been some linking issues in the background or something. Though my workspace contained my imported project, and the link to that project wasn't symbolic (it pointed directly to my project in my workspace) it seemed to be linking to my repository even after the import. I don't know exactly what was going on, but this was my fix.

zgc7009
  • 3,371
  • 5
  • 22
  • 34