1

Android studio does come with a git client but I kind of don't like the idea of providing and storing the email ID and password in an IDE, I'd rather perform stuffs via the terminal, but, the android studio is structured like this:

enter image description here

But, say I saved the (above) android studio project in the ~/Desktop/torlent folder, then wouldn't I have to git init in that same folder? But that folder wouldn't contain these External Libraries or the Scratches and Consoles directories(I suppose they are necessary for proper functioning of the app, although I have no idea) which should perhaps be committed/pushed?

So, what is the proper way to setup git for an android studio project via a terminal?

4
  • If you view your source in "Project Files" mode, you'll see actual fs structure is different (no External Libraries etc). You really should git init in torlent/. Still pls reconsider using android studio directly. Commented Mar 1, 2020 at 15:52
  • 1
    there is no diffenrece between using android studio built in terminal, and separate terminal ( you can even customize if you want the IDE to use CMD, BASH...) so work directly from the IDE like you always do in terminal with no concerns. Commented Mar 1, 2020 at 15:54
  • @ror, I edited the image, and it was in the "Project Files" mode Commented Mar 1, 2020 at 15:57
  • @Chamal , I am not talking about the integrated terminal in android studio, but it has a built in client(GUI) to deal with VCS which is what I don't like using Commented Mar 1, 2020 at 15:58

1 Answer 1

3
+50

I saved the (above) android studio project in the ~/Desktop/torlent folder, then wouldn't I have to git init in that same folder?

If that folder torlent is already a git repo then you don't have to execute git init as it has been done already.

But that folder wouldn't contain these External Libraries or the Scratches and Consoles directories(I suppose they are necessary for proper functioning of the app, although I have no idea) which should perhaps be committed/pushed?

Yes, It won't contain these external libraries and Scratches and Consoles directories as external libraries: These libs are downloaded and linked from SDK so they are quite bulky and should not be a part of the project due to size which will delay upload and download further more it can be a security threat when the libs are private(paid repositories etc)

Scratches and Consoles: These are temporary files and stored under the android studio config folder and the purpose is to share these files across projects. If you want the local file then you can create new directories and files under your repo.

what is the proper way to setup git for an android studio project via a terminal

Follow the steps to setup git repo

Sign up to request clarification or add additional context in comments.

6 Comments

in the "But that folder wouldn't contain these External Libraries or the Scratches an ... " part, if the libraries are necessary for app's successfull and functional build, then if we don't include them while pushing into the repo, won't the version of the libraries affect the build? I mean say I fetch the code 3 years later then how would the specific version of libraries be used? Are these libraries all mentioned in our build.grade file or somewhere else along with their versions?
@juztcode There can be different types of lib, for public libs, the version is always available so no issue though in rare cases, the newer version or alternate lib is always available. if you want to keep some specific libs then you can add them as jar, aar or modules so they can stay with repo, for obsolete/deprecated public APIs, the dependencies should be updated for platform support.
do you know where can we find the External Libraries folder on our hard drive?
@juztcode The platform-specific libs are coming from SDK/platforms and rest of them are stored under caches directory under gradle, you can locate this directory via the path in studio, preferences->Build,Execution,Gradle->Gradle: Gradle user home and SDK path is under Appearance & Behavior->System Settings->Android SDK->platform-> Used-Android-API-> android.jar
after the APK is created does it become independent of the external libraries? or are these provided on every android device for proper functioning of the APK?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.