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

时间:2015-09-14 16:14:32

标签: android git android-studio

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.

1 个答案:

答案 0 :(得分:1)

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.

相关问题