Skip to content

Instantly share code, notes, and snippets.

@lmj0011
Last active January 13, 2021 00:47
Show Gist options
  • Save lmj0011/cee40dcf2fa6a6c83784939f84b82b64 to your computer and use it in GitHub Desktop.
Save lmj0011/cee40dcf2fa6a6c83784939f84b82b64 to your computer and use it in GitHub Desktop.

A guide for working with Android Studio 4.1 on two or more personal Linux(Ubuntu) workstations.

  • More specifically, this is an offline plug and play approach for when you want to switch computers but your code is not hosted on the web

What you'll need:

  • A large capacity external drive (250gb or higher should be more than enough)

  • A base workstation to copy your AS (Android Studio) settings and data from

Directories of Interest

  • Create backups of these directories before proceeding
~/.config/Google/AndroidStudio4.1/options

~/.android

~/AndroidStudioProjects

~/AndroidStudio/DeviceExplorer

# your sdk location may vary 
~/Android/Sdk 

Procedure

From your base workstation:

  • copy the ~/Android/Sdk, ~/.android, ~/AndroidStudio/DeviceExplorer, and ~/AndroidStudioProjects directories to the external drive. You can remove these 4 directories from the Home directory after copying to the external drive.

  • create a symlink for the ~/.android directory linking it to the external drive

example: ln -sfn /media/user/seagate-external-drive/.android ~/.android

  • go to the ~/.config/Google/AndroidStudio4.1/options directory and remove the recentProjects.xml file, otherwise AS will hang next time you open it.

  • open ~/.config/Google/AndroidStudio4.1/options/project-default.xml in an editor and update the android.sdk.path property value to point to the android sdk on the external drive.

From your secondary workstation(s):

Assuming you already have AS installed and haven't done the first run setup yet...

  • connect the external drive

  • create a symlink for the ~/.android directory linking it to the external drive

example: ln -sfn /media/user/seagate-external-drive/.android ~/.android

  • open AS, choose "Custom Setup"

  • on the SDK Components Setup screen, update the sdk path to the location on the external drive.

  • open AS Settings menu, go to Tools > Device File Explorer and update the Download location path to the AndroidStudio/DeviceExplorer location on the external drive.

  • go to File > Invalidate Caches & Restart click Invalidate and Restart

That is all, now you should be able to freely hop to different workstations and continue work from your external drive. Remember to back up your work regularly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment