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.
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
- 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.
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.
Ask permissions the needed project credentials to build and sign the app.
- Create the gradle wrapper on project
- Try to run the build/flavour types