1

Although I searched a lot for Eclipse & Android development in a team methodology, I was not able to find a clear suggestion of a correct way to configure Eclipse and source control environment to work nicely together.


I am a C# developer, and on Visual Studio everything is layed-out nicely:

You Have a solution file (xml) which contains a definitions for the projects and their relations and configuration, in addition each project has its own configuration in a project definition file (also xml). You check-in to source control all the sources and the projects and sln file (the configuration files) and for each new user you just have to checkout (clone) all the files and compile the solution locally - everything is already configured, all you have to do is double click on the solution file and rebuild the solution.

If you have any other dependencies (dll files)- you just add them to your project (could be folder in the project or common folder for several project) and reference the required dll from the project definition, and commit (push, checkin) all the dlls` as part of you source control.

In Addition a solution have virtual folders where you can group several projects together in a logical manner with no technical implications.


In Eclipse and Android specifically - everything is different and mostly not comfortable or logical at all.

You have a workspace with projects - where workspace is not really a solution and its .metadata files are truly meant to be local and should NOT be checked in to source control. What to check-in from an Eclipse workspace .metadata

So you have no solution level configuration to check-in to source control. (Checking out projects and importing them to a workspace and reconfigure everything per client is not reasonable) The only solution I found for that was Projects Set which I have to update manually each time I add project to the workspace (export the project set to a file and commit the changes to the file manually) and in addition this concept ties me to the source control (In visual studio I can copy a solution folder with its projects sub folders and dependencies folder, zip it and send by mail - and everything will work the same). How to organize “projects” and “solutions” in Eclipse? Project Set File Team Project Set

In addition to that in android - for example when using Google play services, the suggested way to reference their lib (jar file and some resources files) is to copy google_play_lib from the sdk and reference the project itself (that is due to resource which must be compiled to your apk file), this means I have to add the google play lib project to my source control - which seems a bad thing to do. References for that: Why do Google recommend copying libraries into your tree? should I check in the Google Play services library project to source version control for GCM support?

So I am kind of frustrated here from eclipse configurations for android and source control management (especially compared to Visual Studio).

Would love any team configurations and source control management tips/tutorials for Eclipse and Android development.

Thanks.

Community
  • 1
  • 1
benchuk
  • 669
  • 7
  • 13
  • A **TL;DR** for people may be nice (Seems op wants to know of ways to set up eclipse for team development)..... Are you still writing in C# for android? if not I would ditch it and use googles Android Studio IDE...it may help with team config but will also make other things easier. Oh and you should narrow your question down to 1 question. – Sayse Jul 21 '14 at 07:03
  • I find Eclipse to be so annoying that I don't bother. I just install tortoise svn, and when I check in I right click in the root directory on disk so I don't miss files. Same for when I update. I prefer to decide for myself when its a good time in my workflow to update anyway. – Gabe Sechan Jul 21 '14 at 07:09
  • Thanks @Gabe Sechan, but my question is not about whether to work with a source control plugin but more about which files to checkin or not checkin and what might be the right approach for team development in general while using eclipse. – benchuk Jul 21 '14 at 08:59
  • @Sayse Hi, I am not writing C# for Android, I just compared my C# development experience with that of Android (using java and eclipse). – benchuk Jul 21 '14 at 09:10
  • In that case I'd highly recommend looking at the Android Studio IDE.. You'll find it easier to accustom yourself to – Sayse Jul 21 '14 at 09:12

1 Answers1

1

I just started developing in Android and I spent 2 days looking into this topic. Below I will summarize what I found on this topic.

Required tools

  • Eclipse
  • ADT Egit - eclipse plugin used for the source control
  • A remote server to store your git repository -> You can have a look at Github
  • Git flow - workflow methodology that can be applied in Git - Check this site for details about how to implement the workflow in Git

You set up a Git repository on the remote server where everyone from your team has access. The git repository can contain anything that the project needs. Resources, assets, source code even additional dependency projects your app needs(Eg. Android Support Library). I recommend creating not storring in the repository the binaries like the apk files, because they change very often.

If someone from your team wants to work on a feature, he or she creates a local copy of the repository(clone). On the clone, it creates a branch for that feature and starts developing the feature. Once the feature is done, it will be merged on the main development branch and pushed to the online git repository. If you use the git flow method, you can have a dedicated integrator making periodic releases from the development branch.

With egit you can import in Eclipse only the projects from the repository you work on. Check the User Guide to get an idea on how to do that

I hope this helps :)

Sitram
  • 1,432
  • 1
  • 14
  • 17
  • Thanks @Sitram, To follow on your suggestion, after you clone the source code, How do you import it to your eclipse workspace? create a workspace and then import -> Android -> Existing Android Code Into Workspace? That means each user has to import the correct projects into his workspace (you do not always need all projects - that is why Visual studio has solutions configuration files) - I am using Project Set currently - But I do not really like that feature for the above reasons (updating the project set file for each change). – benchuk Jul 21 '14 at 09:06
  • In the User Guide for egit, look at chapter 3.2 Starting from existing Git repositories. Once you added your git repository in eclipse you use the import project wizard to import the projects from the repository to your Eclipse workspace. If you have a master git repository for all your projects, you can select only specific projects to be included. I would recommend however to make one git repository/project. When you create a new branch for a feature in git and check it out, the imported projects in Eclipse will be automatically updated to the checked out feature. – Sitram Jul 21 '14 at 10:02
  • Once you are done working on a git repository, delete all projects from the Eclipse workspace, just make sure you don't delete them physically. To work on another app, open the associated git repository for that app, use the import project wizard in eclipse, check out the desired branch for the feature you are developing and you have everything set up in Eclipse. Every team member uses the same technique and it should be fine, plus you don't clutter the Eclipse workspace with a gazillion projects. – Sitram Jul 21 '14 at 10:05
  • I think in that case Project set will be better, at least the projects needed for that feature or application is configured only once. Lets say you have several applications and infrastructure projects and services projects and so on... you would won't to know of memories which projects you need for that application to compile each and every time you setup the environment. But still as per my question above I believe eclipse must have better solutions I am not aware of. – benchuk Jul 21 '14 at 10:16
  • 1
    I am not familiar with Project set so I can't help you there. I store the main project(eg. MyApp) and the related ones(eg. Android Support Library) in the same git repository, without binaries because those are modified quite often. When I import them from the git repository in Eclipse I have everything available and ready to develop. When I make another android app, I make another git repository. I thought about storing all the application I am developing in a giant repository but after some research on the web I found out its not a good idea. – Sitram Jul 21 '14 at 10:24