Search code examples
androidgitandroid-studioversion-controlprojects-and-solutions

Android studio and git


I have tried using git with android studio a few times now and always run to the same problem when another developer starts working on the project. its like Android Studio does not recognize it as a project any more.

enter image description here

this happened today after doing a git pull

i have tried adding the gitignore as is suggested in the first answer on Here

but this did not help. i have a safe backup of this project but i do need to get git working for me properly.

I have followed a few different posts different suggestions on setting up git with android studio but they all have landed me in this situation. Some project file must be getting changed when run on other developers machine.

is there a file(s) that i can copy from my back up to fix this issue or additional files that need to be ignored?

enter image description here


Solution

  • This solved the problem for me- add this line to settings.gradle file

    include ':app'
    

    for accessing settings.gradle use 'project' view instead of 'android'.

    Then go to file->close project -> open existing android studio project-> select project. if that does not work try file-> invalidate cache and restart

    Comment if you dont understand what i mean