Android Studio

Android Studio is an IDE developed by Google based on IntelliJ IDEA and hence sharing common features of IDEs developed by JetBrains. It was specifically adapted for Android Projects using Kotlin or Java.

There are a few life-saving shortcuts

  • CTRL+P: in method(<here>), show the arguments of a method
  • CTRL+SPACE: manually trigger autocompletion (then use TAB)
  • SHIFT+SHIFT: search for a method/class/setting...
  • ALT+ENTER/hover something highlighted in red, yellow, gray... to see quick fixes/details.

Configure in-editor documentation

To see the documentation of a method, use CTRL+Q or hover a method. By default, you won't see anything interesting.

  • Navigate to the source of any Android class. As a reminder, you can use CTRL+(MOUSE LEFT) like in VSCode/...
  • Click on "Download sources"
  • Done

Layout Editor

Instead of editing the XML manually, you will usually use the Design mode.

  1. Mode: you can switch to the XML/Layout editor here
  2. Palette: views that you can drag and drop to the design view
  3. Design view: what the user will see
  4. BluePrint view: Design View, but with hidden elements too
  5. Component tree: list of all views of your screen
  6. Attributes: edit the properties of a view

Layout Editor

TIP: you should rely on CTRL+F to search for attributes, or by clicking on the search icon at the top of the "Attributes" window.

TIP: you will most likely have a time when you want to replace a view with another view. In the component tree, right-click on a view, and use "convert view". You could also manually get the job done by directly editing the .xml.


πŸ“± Random features πŸ“±

Gradle

In the Project tab, at the bottom, you got a section "Gradle Scripts". You will have to edit the second build.gradle (Module: XXX).

gradle

Inside dependencies {}, you will add new libraries. You need to click on "sync" (when prompted) each time you add a new dependency.


app/manifests/AndroidManifest.xml

This is a file that describes

  • What is the main activity (~=screen)?
  • What activities (~=screens) you defined?
  • What are the permissions that your application needs?
  • If your application defines services (~=tasks)?
  • ...

app/java/com.xxx.yyy

This is where your classes will be stored.


app/res

This is where the resources of your application will be stored.

  • Drawables (images, icons...)
  • Layouts (the layout of each screen)
  • Menu
  • Values (translations, colors/themes...)
  • XML (preferences...)

Resources Manager

You can manage them from the Resources Manager

  • From the Left side, right under "project"
  • with View > Tools Windows > Resources Manager

Resources Manager Android Studio


Device Emulator

The device emulator allows you to create a virtual device or connect yours. You may (or most likely will) use

  • Device File Explorer: device's file system
  • Layout Inspector: running app layout
  • App inspection: to see workers/tasks/...
  • Logcat: to see logged messages

Note: you may have to refresh the virtual file system manually if you don't see recent changes.

Note (2): on virtual devices, use "..." to manually change settings (location...).

device_manager


πŸ‘» To-do πŸ‘»

Stuff that I found, but never read/used yet.

  • Action on Save: Optimize imports