Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing in Android Studio on 2 computers - and app.iml always changes

I develop an Android app on 2 computers (using git to sync) - Windows 7 and Mac OS Yosemite.

For some reason the file app.iml is always changed when I open the project:

diff screenshot

Sorting dependencies in the build.gradle alphabetically hasn't helped:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.facebook.android:facebook-android-sdk:4.1.0'
    compile 'com.google.android.gms:play-services-gcm:7.8.0'
    compile 'com.google.android.gms:play-services-plus:7.8.0'
    compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.vk:androidsdk:1.5.10'
    compile 'de.hdodenhof:circleimageview:1.3.0'
}

Can anything be done here? So that I am not forced to commit the changed file again and again?

I am using .gitignore for Android recommended by GitHub.

like image 806
Alexander Farber Avatar asked Nov 09 '22 05:11

Alexander Farber


1 Answers

Add it to your .gitignore file. Then, run git rm --cached app.iml so that it's no longer tracked from that point on. Considering that you're using Gradle for your dependencies, everyone else's local installation of Android Studio should be able to work with that as opposed to dealing with a shared app.iml.

While there are some JetBrains/IntelliJ/Android Studio project files that you can put into source control, my standing recommendation is not to, for this very reason: you're going to have a lot of changes to those files that are not germane to the actual production code itself.

like image 56
Makoto Avatar answered Nov 14 '22 22:11

Makoto