java - Android Library Projects on Windows and Mac -


i'm asking question on behalf of team of 2 android devs. use windows , partner uses macbook. when sharing project through git, classpaths accidentally got messed up. here few observations:

  • the library projects referenced (working initially) can't resolved anymore.
  • when adding through projects tab in 'java build path', libraries can found.
  • but app crashes (due noclassdeffounderror), again pointing towards messy build path structure.
  • initially referenced library projects on mac used appear directly in build path jars. under android dependencies, weird (the former more).
  • on windows, above jars have been under dependencies , referenced libraries.

i'd resolve issue in way can share project on git , work seamlessly in future. :)

one option to:

  • not version .classpath,
  • version classpath template
  • generate right classpath depending on current platform code checked out.

that called content filter driver, here smudge script, called automatically (hence "seamless" aspect) on git checkout, , generate actual .classpath (otherwise not versioned , add in .gitignore)

http://git-scm.com/book/en/v2/book/08-customizing-git/images/smudge.png

(image shown in "customizing git - git attributes", "pro git book")

note can remove (without deleting locally) .classpath repo:

git rm --cached -- .classpath git add -u . git commit -m "delete .classpath" git push 

Comments