Android Studio:使用Mac(OSX)和Windows为同一项目更改SDK位置

Android Studio:使用Mac(OSX)和Windows为同一项目更改SDK位置,第1张

概述我正在开发一个AndroidStudio项目,我的团队成员使用Windows并使用OSX.问题是,当我从git中提取新代码然后打开项目时,我会根据Mac的SDK位置进行各种更改:首先打开项目时的通知:gitdiff记录了一系列与此类似的更改:我们如何配置AndroidStudio项目以便不必进行这些自动代码更改,

我正在开发一个Android Studio项目,我的团队成员使用windows并使用OSX.

问题是,当我从git中提取新代码然后打开项目时,我会根据Mac的SDK位置进行各种更改:

首先打开项目时的通知:


git diff记录了一系列与此类似的更改:

我们如何配置AndroID Studio项目以便不必进行这些自动代码更改,或者可能有一种方法可以最小化更改的文件数量?

更新:

我更新了.gitignore并将其推送到远程仓库.

当我的团队更新了更多代码并将其拉出来时,我仍然遇到了同样的问题.

这是拉后我的git状态的片段(我用“…”来表示该文件夹中的多个文件):

modifIEd:   .IDea/gradle.xmlmodifIEd:   .IDea/misc.xmlmodifIEd:   .IDea/modules.xmlmodifIEd:   .IDea/vcs.xmlmodifIEd:   app/app.imlmodifIEd:   app/build/intermediates/incremental/mergeAssets/androIDTest/deBUG/merger.xml…    modifIEd:   app/build/intermediates/incremental/mergeResources/deBUG/merger.xml    modifIEd:   app/build/intermediates/res/deBUG/anim/abc_fade_in.xml...    modifIEd:   app/build/intermediates/res/deBUG/anim/abc_slIDe_out_top.xml    modifIEd:   app/build/intermediates/res/deBUG/color-v11/abc_background_cache_hint_selector_material_dark.xml    modifIEd:   app/build/intermediates/res/deBUG/color-v11/abc_background_cache_hint_selector_material_light.xml    modifIEd:   app/build/intermediates/res/deBUG/color/abc_background_cache_hint_selector_material_dark.xml...    modifIEd:   app/build/intermediates/res/deBUG/color/wallet_secondary_text_holo_dark.xml    modifIEd:   app/build/intermediates/res/deBUG/drawable/abc_btn_borderless_material.xml...    modifIEd:   app/build/intermediates/res/deBUG/drawable/timeline_button_hover.xml    modifIEd:   app/build/intermediates/res/deBUG/layout/abc_action_bar_Title_item.xml...    modifIEd:   app/build/intermediates/res/deBUG/layout/support_simple_spinner_dropdown_item.xml    modifIEd:   app/build/intermediates/res/deBUG/menu/menu_all_locations.xml    modifIEd:   app/build/intermediates/res/deBUG/menu/menu_main.xml    modifIEd:   app/build/intermediates/res/deBUG/values-af/values-af.xml...    modifIEd:   app/build/intermediates/res/deBUG/values/values.xml    modifIEd:   app/build/intermediates/resources/resources-deBUG-androIDTest.ap_    modifIEd:   app/build/intermediates/resources/resources-deBUG.ap_    modifIEd:   build/intermediates/gradle_project_sync_data.bin    modifIEd:   local.propertIEs

这是我的.gitignore,正如@GabrIEle Mariotti所建议的那样:

#built application files*.apk*.ap_# files for the dex VM*.dex# Java class files*.class# generated filesbin/gen/# Local configuration file (sdk path, etc)local.propertIEs# windows thumbnail dbThumbs.db# OSX files.DS_Store# Eclipse project files.classpath.project# AndroID Studio*.iws*.iml.IDea.gradlebuild/*/build/

我是否需要额外的.gitignore配置?如果我排除.IDea那么为什么这些文件会显示为已更改?

解决方法:

在项目内部,您将找到一些AndroID Studio文件,例如每个模块中的.IDea和iml文件.
另请查看this answer了解更多详情.

这些资源包含本地路径和引用,您应该从git仓库中排除它们(.IDea文件夹和iml文件).

这是我们与Mac,linux和windows用户一起使用的.gitignore的一个例子.

#built application files*.apk*.ap_# files for the dex VM*.dex# Java class files*.class# generated filesbin/gen/# Local configuration file (sdk path, etc)local.propertIEs# windows thumbnail dbThumbs.db# OSX files.DS_Store# Eclipse project files.classpath.project# AndroID Studio*.iws*.iml.IDea.gradlebuild/*/build/

如果这些文件位于git repo中,则应从远程仓库中删除它们,然后重建本地项目.

总结

以上是内存溢出为你收集整理的Android Studio:使用Mac(OSX)和Windows为同一项目更改SDK位置全部内容,希望文章能够帮你解决Android Studio:使用Mac(OSX)和Windows为同一项目更改SDK位置所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1108063.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存