Mobile app development is a long and laborious process. However, companies now want to release apps as quickly as possible. Fortunately, there are a number of tools available to help mobile developers speed up their work.
The toolset available is constantly updated as new versions of mobile platforms become available. Yes, it’s hard to keep up with all the innovation. The same goes for additional features that aren’t usually published, even though they’re really useful in regular operations.
In particular, there are a number of issues that every Android developer must address when creating a mobile app. Such as:
- Check how the layout looks before it runs to the device
- Run code checking tools such as Lint: It is difficult to find errors in code before compilation
- Provide selection options for all display resolutions and states (enable, disable, press, etc.) of bitmap graphics and export them to different digital devices
- Detect memory leaks during the development phase of the debug APP build
Experienced developers can handle these tasks with ease. However, the way to solve pressing problems quickly and efficiently is not known to everyone. Let’s take a closer look at some of the must-know tools for effective Android development.
1.Tools Attributes
Task: Check what THE UI elements look like during development to avoid surprises in the final build.
Solution: Tools Attributes
Tools Attributes can use additional namespaces to help manage Android Studio so that the development framework does not transfer runtime version Attributes to the final build.
There seems to be only one way for Android developers to check out the finished layout — run it on the device. However, you can also use Tools Attributes built into the development framework, which in our case is Android Studio.
Tools Attributes fall into two main categories:
- Lint Attributes
- Design Attributes
As a static analysis tool, Lint is used in many programming languages and software platforms. Applying Lint Attributes helps coordinate how Lint works.
Here are some specific Lint Attributes:
tools:ignore
Tools: Ignore allows you to build Lint tools to disable warnings for specific attributes in XML files. Such as:
tools:targetApi
Tools: The targetApi annotation works in the same way as the @TargetAPI annotation, which shows the lowest VERSION of the API that the app will use. For example, if you are using Android KitKat and the lowest API version in your project is 21. In this case, just write Tools :targetApi and the appropriate version number in the code. This can avoid annoying Lint warnings.
tools:locale
This property helps you configure the language and turn off Lint warnings about misspellings. For example, if your string contains only Spanish text, then you can set “Spanish as default” :
As for Design Attributes, you can greatly facilitate the creation of XML layouts within your development framework.
Design Attributes include:
tools:context
Tools: Context can be used to show what activity classes the development framework chooses to implement the layout. Using this property, Android Studio automatically selects the desired theme for the preview.
tools:showIn
Tools :showIn helps indicate which layout you want to showIn the preview. Such as:
tools:listitem, listheader, listfooter
You can easily adjust the component view with a specific layout to separate the list, header, and footer elements. Such as:
tools:layout
Use the Tools: Layout property to display the fragment label layout on the screen at runtime:
Therefore, Tools Attributes can help developers ensure that they are always safe from the risk of displaying temporary text in the final app build.
2.Support Annotations
Task: Check for possible errors in the code before compiling, and do a thorough review of the code to prevent errors
Solution: Android Support Library
Android Support Library Annotations help Android Studio improve code. It is useful from Android Studio 1.3.0 onwards. For previous versions, you need to insert separate annotations.
The Android Support Annotations Library allows you to find bugs in your app during development. By adding annotations to a project, developers can make the task of keeping code pure much easier.
Support Annotations can be divided into:
Annotations @nullable, @nonNULL Nullness Annotations Are designed to check for null. They can be applied to code fields, parameters, and methods. The main difference between using these completely unannotated Annotations is that Nullness Annotations only define whether a variable has a “null” value.
Mobile developers often reference strings, images, and other resources when coding. Using Resource Annotations, you can force input text. For example, by adding resource annotation @colorres, you get a frame warning when you try to enter a color code instead of referring to a Resource ID. Without annotations, the IDE does not react because the code and reference to the Resource ID are expected to be of type int.
ColorInt Annotations @colorint @colorint is the opposite of @colorres. In this case, you define methods that don’t refer to resource IDS, but to specific colors. Applying @colorint Annotations allows you to quickly find errors if the method calls for a color resource ID.
The purpose of Thread Annotations @UithRead, @MainThread, @WorkerThread, @BinderThread is to determine the connection between a method and a particular type of Thread.
Value Constraint Notation @size (min = 5), @intrange (from = 0, to = 12), @floatRange (…) It is almost impossible to use normal values for parameters when coding. To define the range of possible values, you can add @intrange or @floatrange annotations. The @size annotation is a great tool if you want to limit the Size or length of strings in data arrays, collections, or threads.
Permission Annotations @ RequestPremission (Manifest) Permission) ACCESS_FINE_LOCATION) using Permission Annotations, You can validate a permission or a list of permissions. Every time the app references a method, it provides an acknowledgement, and the list of permissions is open to you. If the permission does not exist, you will find errors in your code.
CallSuper Annotations @callsuper You use this annotation when you need to call the super implementation of a method.
Annotations of the type Enumerated Annotations IntDef and StringDef allow the creation of generalized definitions to replace some Enumerated constant values. For example, you have the IceCreamFlavourManager class, which includes 3 modes: VANILLA (VANILLA), CHOCOLATE (CHOCOLATE) and STRAWBERRY (STRAWBERRY). Using @intdef, you can create a new annotation called @flavour and define its specific value.
3.Cut&Slice me
Task: Receive bitmap graphics with all display resolution options.
Solution: Photoshop plugin Cut&Slice me
Cut&Slice me allows only the cutting of bitmap graphics to be generated by pressing a button. It is used to implement all display resolutions and states (enabled, disabled, pressed). For Android, resources are automatically transferred to different folders (drawable-xxhdpi, drawable-xhdpi,..) For iOS, the correct name prefix is created ((@2x, @3x).
We have been actively using the plugin Cut&Slice me since 2013. And it’s very popular with Android and iOS developers.
- LeakCanary
Task: Detect memory leaks in time to prevent OutOfMemoryError crashes and reduce the risk of app memory overflow. Solution: library LeakCanary
LeakCanary helps detect memory leaks during debug build runs and provides a comfortable UI for stack tracing history.
Most of the time, developers must manually look for memory leaks. First, they uncover OutOfMemoryError crashes. Then using different devices, they tried to reproduce the problem that could have caused the error. In addition, they want to be able to follow the sequence of operations that lead to leaks. They create memory dumps and study them in detail to find objects that should be garbage collected. Then, they make the shortest reference path from the object to the garbage collection, and finally, they get the reference that causes the memory leak.
LeakCanary allows all search studies to be automated and all leaks to be found quickly. An additional advantage involves sending data about leaks to the server and excluding reflection references and specific activity from the method.
In summary, we can say that Android developers have a variety of different tools available to facilitate the app development process. In particular, there are a number of forgotten or even unknown solutions for mobile developers, such as Tools Attributes, Support Annotations, Cut&Slice me, LeakCanary, And bug Reporting Systems. We’ll talk more about that last tool later. The choice of tools depends largely on the developer’s personal preferences and the specific project situation.
If you’d like to tell me what tools you think you must have, feel free to comment in the comments. Expect to hear different voices.
I wish everyone a clean code and a successful project!