Skip to content

Instantly share code, notes, and snippets.

@alex-amenos
Last active December 1, 2019 01:21

Revisions

  1. alex-amenos revised this gist Dec 1, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion android_studio_setup.md
    Original file line number Diff line number Diff line change
    @@ -57,4 +57,4 @@ 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 debug/uat/release build type
    2. Try to run the build/flavour types
  2. alex-amenos created this gist Dec 1, 2019.
    60 changes: 60 additions & 0 deletions android_studio_setup.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    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](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 debug/uat/release build type