0

My Android Library Project was working fine until I made a git repository of it.
Now references to the ALP in other projects Properties->Android->Library show up with a red cross in front. Remove, Apply and then Add again provides a green check, but the resources are not found and on returning to the Properties->Android dialog the red cross is there again.
Is it possible to use an Android Library Project from git. If yes, how?

redocoder
  • 201
  • 2
  • 9

1 Answers1

0

Usually, to create a git repository in the "less intrusive way" you simply enter the directory of your project (using a shell if you are on unix or the git shell if you are on windows) and type:

git init

after this you have a git repository. This doesn't influence in any way the way eclipse access your project so everything should work as before.

After that, if you want eclipse to "see" you git repository you just have to right click on your project and select the Team|Share Project option and add the git repository that you just created.

vratojr
  • 818
  • 2
  • 8
  • 25
  • My git Android Library Project is in eclipse. I can select it with in Properties->Android Library Add and when I look again it shows up with a red cross and a question mark under Project – redocoder Aug 12 '14 at 08:38
  • my advice is to recreate your project, add a git repository the way I told you and then reference it from other projects. – vratojr Aug 12 '14 at 08:54
  • The git repository was added with Team->Share Project->Git
    In the Configure Git Repository dialog a new repository was created under the git directory (I have no git, just egit)
    – redocoder Aug 12 '14 at 09:02
  • so your git repository is created in the root directory of your project? I mean, you have a directory called .git under $workspace/$project_name directory? – vratojr Aug 12 '14 at 09:12
  • No, the directory called "git" is under my user directory. Should that make any difference? – redocoder Aug 12 '14 at 09:23
  • the fact is that, doing that way, you project is moved from it's actual position into the workspace to the NEW location of the git repository. Just check your filesystem and you'll see that your project is not anymore into your workspace (or maybe it's there but there are missing files). Personally I don't like this way of handling git repository proposed by egit. If you want to create your git repo with egit, check the "Use or create repository in parent folder of project" in order to be sure to have your .git folder inside your project and that your project is not moved. – vratojr Aug 12 '14 at 09:34
  • I have found that here http://stackoverflow.com/questions/5167273/in-eclipse-unable-to-reference-an-android-library-project-in-another-android-pr?rq=1 as well. Sadly there is no easy way to undo egit commands, so I had to manually copy the project back to the workspace, remove the old project, import the new project, start the new repository in the workspace and reestablish all the links. Then it worked again! Now what? Keep all my repositories distributed in my workspace, which is just recovered from the last time eclipse got completely stuck? – redocoder Aug 12 '14 at 11:35
  • You can keep your git repo in the workspace without any problem. If by chance, you have to recreate your workspace you just have to remember that the git repository is just a normal directory so, before destroying the workspace you can simply "copy away" your .git dir and copy it back into the project directory once done. After that you can instruct egit to use your existing repository with _Share Project_. – vratojr Aug 12 '14 at 11:48