First post here, I bought the Android development book and got to the point where it said something about reading a Java book first so I put it down and have been working my way through a Java book the last month or two. Anyway, I think I’m familiar enough with Java to get back into this book and I’d like to find a way to work on projects across multiple machines. I have a laptop for work and desktop at home. I tried saving projects to google drive but when I opened it on another machine it didn’t turn out to pretty. Any suggestions?
I’d use git (and github) to keep track of your code across computers. I just finished the Android 2nd edition book myself, and I found git to be quite useful in 2 ways …
1.) Like what you are looking for, it’s a simple way to have access to your code anywhere. Each time the book had me start a new app, I would create a (local) git repo for it, and a corresponding remote repo on my github account. Then, whenever I finished work on my work computer, I commit my latest code, and push it to my git hub repo. Then when I get home to my desktop, I can pull my code from github to my desktop’s local repo and pick up right where I left off.
2.) Git was really great for tackling the “challenges” at the end of each chapter. The book recommends that when you move on to the next chapter (say from ch6 to ch7), that you start ch7 WITHOUT any challenge code from ch6. It recommends making a copy of your project each time (to work on challenges AND to start a new chapter), but then you end up with A LOT of copies of the same project on your system. Using git, there’s a better way. I simply have a branch for each chapter (say, a “ch6” branch). When I complete the chapter, I commit everything to my ch6 branch, and then create a new branch off of it, ch6-challenge, and complete the challenge in that branch. Then when I’m ready to start ch7, I just go back to my ch6 branch and make a new branch off it, ch7, and start on chapter 7! Best of all, at any time I can go back and check out any of my branches to get to code from a specific challenge or chapter. There is one spot in the book where they do something like, “if you completed the challenge from 4 chapters ago, go back and grab that snippet of code for this chapter”. Since I have everything in git with chapter and challenge branches, that was a snap.