Skip to content

Latest commit

 

History

History
161 lines (100 loc) · 6.94 KB

android.md

File metadata and controls

161 lines (100 loc) · 6.94 KB

Android

  1. Platform Versions
  2. Development Tools
  3. User Interface
  4. Coding Conventions
  5. Best Practices
  6. .gitignore
  7. Test-Driven Development
  8. Preferred Libraries And Frameworks
  9. Location
  10. Dependency Management
  11. Project Environments
  12. Release Key
  13. Graphic Assets
  14. ProGuard
  15. Useful Links

Platform Versions

Min SDK Version

Support Android OS versions starting from 5.0 (Lollipop, API Level 21). Do not support older versions (2.2 Froyo, 2.3 Gingerbread, 3.x Honeycomb, 4.0.3 - 4.0.4 Ice Cream Sandwich etc). Check Dashboard page for information about platform versions, screen sizes and densities statistics.

Target SDK Version

For new projects, use latest stable version: Android 11 (API level 30). Do not use beta versions or developer previews.

Development Tools

JDK

Use Java Development Kit (JDK) version 8.

IDE

Use latest stable Android Studio.

Coding Conventions

Follow MLSDev Android Coding Conventions.

Use Android Studio for auto formatting.

Best Practices

  • Prefer Kotlin to Java for new projects
  • Avoid anonymous classes usage
  • Use ContentProviders
  • Prefer Services for long-running background tasks
  • Understand Coroutines and LiveData usage.
  • Use Analyse->Inspect Code in Android Studio for static analysis of project code and XML at the end of each development cycle (Iteration, Spring, Milestone etc)
  • Use MVVM architecture

User Interface

Follow Android Design Principles, particularly the Style Guide.

Useful links:

.gitignore

Use IDE for default .gitignore file generation. Do not forget about OS temporary files (.DS_Store in Mac OS, Thumbs.db in Windows etc).

Test-Driven Development

Preferred Libraries And Frameworks

Location

Prefer Google Play Services to LocationManager

Dependency Management

Never add third-party source code or libraries to project repository. Use Gradle and Maven.

Project Environments

Project should contains at least 2 Gradle tasks: Release and Debug.

Release task should include:

  • release build signing (see Release Key section)
  • positive Crashlytics flag
  • configuration for the stable API version

Debug task should include:

  • debug build signing
  • negative Crashlytics flag
  • configuration for the development (staging) API version

Release Key

  • Release key file can be stored in project tracker (JIRA, Redmine etc), password can be on Wiki page or some other private/secured place.
  • Generating Release key. Main information needed from client - company name and location.
  • Info on Jenkins setup

Graphic Assets

  • Require graphic designers to provide assets in all sizes (mdpi, hdpi, xhdpi, xxhdpi etc).
  • Prefer 9patch graphics.
  • Prefer Multi-Density Vector Graphics.

More info: MLSDev Design Requirements

ProGuard

  • Use Proguard tool for improving security of your application. Proguard obfuscates your code by renaming classes, fields, and methods with semantically distorted names. The result apk file is more difficult to reverse engineer. It's important to use Proguard when your application should hide authorization protocol (e.g. client_id and client_secret of OAuth).
  • Proguard tool shrinks and optimize your code which can help you remain within 65k methods.

Warning

When working with legacy code it's important to know is ProGuard enabled or not. While you are making changes you should add appropriate rules into configuration file.

Warning

Whenever ProGuard runs, it outputs a mapping.txt file, which shows you the original class, method, and field names mapped to their obfuscated names. You must keep mapping.txt file for every release build, otherwise you will be unable to read stack trace of crash reports.

Useful Links