This tutorial guides you on how to fix Invalid VCS root mapping android studio project error that you are facing while opening ionic project in android studio.
Invalid VCS root mapping – android studio project error
Basically, I just downloaded an healthcare.zip project and wanted to run the application in android studio (android device).
I had setup nodejs and ionic to run the application in browser. After setting up and running the application in browser wanted to try to run the app in android studio.
To run the application in android studio, I had followed the below steps.
> npm i > ionic build > npx cap add android > npx cap sync android > npx cap open android
The last npx command npx cap open android will open the android studio software with current running project. Running that command opened the android studio software with current project, but it resulted in following error “Invalid VCS root mapping… registered as a Git root, but no Git repositories were found there” as shown below.
Invalid VCS root mapping The directory C:\Users…ents\sneppets\healthcare is registered as a Git root, but no Git repositories were found there.
Fix Invalid VCS root mapping error
For my scenario, I did not clone the project from Git instead downloaded the project zip and trying to run the app.
If Git is installed in your machine and if you had cloned the project repo from Github, then the project directory will have .git repositories. Therefore the Git repositories were missing since it is not cloned from Git.
To fix Invalid VCS root mapping error, try to locate file called vcs.xml. You could find that file in the following path.
If you check that vcs.xml file, it contains some info/ path related to Git which was not found on your machine.
Therefore, first I closed the android studio and tried renaming that file to vcss.xml and ran the command npx cap open android again. This workaround worked for me and I did not see the error again.
Note, I did not delete any folder or file, I just renamed the vcs.xml. But there are other recommendations to delete vcs.xml file or .idea folder itself. But I would recommend to take backup before you try any of these.
That’s it. Hope it helped 🙂
- How to Set Windows PowerShell Environment Variables
- Visual Studio Code install location and Path issues from Terminal
- npm ERR! enoent – This is related to npm not being able to find a file
- spawn git ENOENT npm error
- Git – How to compare files in two different branches
- GitHub unable to access HTTPS and SSL routines error
- ‘ionic’ is not recognized as an internal or external command
- Unable to connect to the server: dial tcp i/o timeout