Sync Android Studio projects on multiple workstations

I want to work on several workstations, synchronously jumping from one to another, without worrying about committing.

I have a personal Windows desktop and Mac OSX laptop. At the moment, I point my project to the cloud directory and the local installation of Android Studio, pointing to the offline gradle cache in another cloud directory. This does not work, as it tells me that the path to gradle is invalid. Which I understand because gradle is referenced in different places on another computer (given the different file management system in MACOSX and Windows7).

Edit: When I try to open a project, it displays the "Import Project from Gradle" screen. To do this, I have the opportunity to select "Use local gradle distribution" and select the gradle home directory. I pointed it to the cache directory, and it tells me:

Cannot Save Settings Gradle location is incorrect. Location:C:/Users/Username/.gradle 

All my research (including these answers here and here ) show that VCS is the way to go. However, I do not see this as a solution to my problem. I do not look at version control, I am looking for a smooth transition between workstations. Of course, I will continue to use the version control system in order to keep the working version of my code or share it with other developers, but there should be a better way when I just want all workstations to be synchronized.

I came from web development and I am synchronizing the local environment on AMPPS on several computers without any problems. This meant that I could switch from my desktop, laptop and desktop instantly. It disappoints me if I have to remember to commit every time I move. If I have to do this 20 times a day, and it takes about a minute to do this, that is 20 minutes, which could be spent writing several functions. And what if I forget to make a deal, then I will come to work or home, it will be a day wasted, because in fact I will not have the current current code ...

So the question remains, is there a way to instantly sync Android Studio projects? How to keep synchronization of my entire code base (i.e. gradle)?

+5
source share
1 answer

Ok thanks to the comments above that pointed me in the right direction.

Android Studio will create some local files specific to the machine you are on. Following this principle, in order to synchronize the "source" files (files specific to your application only), you must ignore all these local files. This is similar to what you would save on github. I followed the answer for this question to apply ignore rules.

Ignoring all the "local files", when I create a new project, the source files are synchronized on all my workstations. To create a local version, I first need to β€œimport” the project. After importing it, "local files" will be created for this particular machine. From now on, I can "open" the project locally.

Summarizing:

  • Set synchronization to ignore files according to .gitignore or refer to question .
  • Create a project on one of your workstations and save it in the cloud.
  • When you are ready to work on a project for the first time on another workstation, import the project.
  • After importing the project, all local files must be created.
  • From now on, use the "open" option to continue working on the project.

I hope this helps someone else by saving hours on search engines.

+5
source

Source: https://habr.com/ru/post/1205359/


All Articles