I code in MAC - OSX and my partner codes in PC - Windows but when I commit and push changes there are multiple files in project directories ending with .IML or .config or .properties, which gets overwritten and cause frequent overwrites which is a nuisance.
So my question is which files can be excluded from GIT for Android Studio Gradle Project to maintain the code in MAC as well as Windows? and what is the best way to do it ?
Tracked files are files that were in the last snapshot, as well as any newly staged files; they can be unmodified, modified, or staged. In short, tracked files are files that Git knows about.
Where are dependencies stored in Gradle project? The Gradle dependency cache consists of two storage types located under GRADLE_USER_HOME/caches : A file-based store of downloaded artifacts, including binaries like jars as well as raw downloaded meta-data like POM files and Ivy files.
Go to buildscript > repositories and configure the Maven repository address for the HMS Core SDK. If the agconnect-services. json file has been added to the app, go to buildscript > dependencies and add the AppGallery Connect plugin configuration and Android Gradle plugin configuration.
Here is a decent .gitignore
file which you put in the root directory of your project, e.g. the folder where the .git
folder is:
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Store
# Eclipse project files
.classpath
.project
# Android Studio
*.iml
.idea/
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
.gradle/
build/
app/build/
gradle/
#NDK
obj/
Then you execute the following commands to apply the .gitignore
:
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
See more here.
EDIT: I also recommend using the .gitignore plugin for Android Studio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With