Building the Android Open Source Project |

Working on the Android platform is a task addressed by Google and OEMs mostly. In this tutorial, you’ll get insights into building the AOSP.

This is a companion discussion topic for the original entry at

I have been going through this tutorial, but I’m having a problem part way through. I’ve set everything up, and I’ve verified that my results match your screen shots to verify that I’ve set things up correctly. The problem occurs when I switch to the /home/aosp/source directory and run the ‘repo sync’ command. Everything looks to be running smoothly for over an hour, and then I start seeing messages like this:

error.GitError: Cannot fetch platform/external/cn-cbor init: fatal: unable to get current working directory: No such file or directory

If I try to run ‘repo sync’ again, I get this:
Traceback (most recent call last):
File “/home/aosp/bin/repo”, line 1343, in
File “/home/aosp/bin/repo”, line 1278, in main
repo_main, rel_repo_dir = _FindRepo()
File “/home/aosp/bin/repo”, line 1026, in _FindRepo
curdir = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory

It seems as though I am losing my connection to the directory that I’m trying to save things to. Any suggestions?

If I just enter “cd …” then “cd source” followed by “repo sync” it starts working again. I’m not sure if it continues from where it left off, or if starts from the beginning of the process.

Oh, that’s unfortunate. There are many things that could go wrong while building the AOSP.
According to the info you provided, it could be that that repository in particular has some issues (platform/external/cn-cbor). Which branch did you actually use during the “repo init” step?

Afaik “repo sync” will continue to sync from where it stopped, assuming you didn’t delete any content from your local source folder.

I think I’m on to something. I am on a MacBook that is running Ubuntu as a virtual machine through Parallels. I did not want to dedicate 300GB to my virtual machine, so I was using a shared folder and the destination for my repo. I am trying the process again right now with my repo on an external hard drive and so far it has been going for about 3 hours without any problems. So my guess is that the shared folder was getting disconnected during the process. I’ll let you know how it goes on with the external hard drive.

In regards to your question, I used the defaults for the repo init:

> repo init -u

Thanks for your help!