Lonergan6275
Lonergan6275

Reputation: 2038

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

Upvotes: 1

Views: 203

Answers (2)

Shreyans
Shreyans

Reputation: 1061

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

Upvotes: 1

Vikram
Vikram

Reputation: 778

Please try after putting below in .gitignore of both app & project module.

In Project module's .gitignore -

 .gradle
    /local.properties
    /.idea/workspace.xml
    /.idea/libraries
    .DS_Store
    /build
    /captures
    *.iml

& in app module's .gitignore -

/build
app.iml

Check Screenshot

Hopefully it will work well for you.

Upvotes: 1

Related Questions