Skip to content

Instantly share code, notes, and snippets.

@alex-amenos
Last active December 1, 2019 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-amenos/72a97c7ef548da64190f1678ca7ffa2a to your computer and use it in GitHub Desktop.
Save alex-amenos/72a97c7ef548da64190f1678ca7ffa2a to your computer and use it in GitHub Desktop.
Android Studio Setup

Before to start working on the project you can follow some project rules to achieve project quality without effort.

You can create a scheme if you want for this project.

Android XML arrangement

Verify you Android XML arrangement

- Select Android Studio Preferences
- Select Editor > Code Style > XML
- Select the "Arrangement" tab
- Select "Select from..."
- Select "Predefined style" > "Android"
- Click Apply to apply changes

Disable wild cart import in IntelliJ/AndroidStudio in kotlin language

- Select Android Studio Preferences
- Select Editor > Code Style > Kotlin
- Select the "Imports" tab
- On "Top-level Symbols" select "Use single name import"
- On "Java Statics and Enum Members" select "Use single name import"
- On "Others" check "Insert imports for nested classes"
- Add on "Packages to Use Import with "*"" the synthetic package: kotlinx.android.synthetic
- Click Apply to apply changes

Follow this link if you need help to disable wildcard import in Android Studio with Kotlin:
https://stackoverflow.com/questions/49870306/disable-wild-cart-import-in-intellij-android-studio-in-kotlin.

Reformat on save the faster way

With 3 simple steps you can format your code automatically with ⌘ + S. That shortcut you are used to pressing constantly although you know Android Studio automatically saves all files for you . Give ⌘ + S a different meaning:

Make sure a Java source file has focus (or you can’t record all steps)
- Select Edit > Macros > Start Macro Recording
- Select Code > Optimize Imports
- Select Code > Reformat Code
- Select File > Save All
- Select Edit > Macros > Stop Macro Recording and give it a name (mine is OptimizeImportsReformatRearrangeSave)
Go to Preferences > Keymap
- Find the Macro section
- Add ⌘ + S shortcut for the new macro

Alternatively, you can reformat code with ⌥+⌘+L . When you select parts of your code, only those get reformatted. This doesn’t reorder your code or changes imports. I use it when touching code which doesn’t have a code style.

Project credentials

Ask permissions the needed project credentials to build and sign the app.

After to clone project

  1. Create the gradle wrapper on project
  2. Try to run the build/flavour types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment