Tweaks & Tricks

Table of contents


Android Monitor

Remove useless information from the LogCat

We can remove Show process and thread IDs (PID-TID) and Show package name from the Log Header

Clear log prevention during a crash

From Edit Filter Configuration, we just need to add a filter based on our app package name and that will fix the problem:

Remove File Header from Includes

Nowadays git versioning is much more useful rather than having headers. Get rid of the header.

If you are using Kotlin, I would also recommend removing it from all the Kotlin files. You can either remove the code from the Includes tab, or remove the #parse("File Header.java") from the desired files in the Files tab:

Class
Interface
Enum
AnnotationType
package-info
Singleton

You can do the same with Test files:

Groovy JUnit Test Case
JUnit3 Test Class
TestNG Test Class
...

Modify test templates

After reading this Sandro Mancuso’s post and trying this naming for a while, I think tests are more readable. Why having the Test suffix in a file we already know it’s in the test container? Why having test prefix in every JUnit method in a test class? Do you also think it’s redundant? Try this:

IDE behaviour

Project in New Window

In case you haven’t got configured this parameter, this would be likely to be your setting.

  Appearance & Behaviour
      - System Settings
          └── ✓ Open project in a new window


Language injection

In a String, let’s say:

final String titleJson = "";

You could press alt + enter and select Inject language or reference and choose between the different options. The most used injected code will be JSON and RegExp. Once selected the injected language, we need to press alt + enter again and open the editor related to the chosen injected language.

More info here and here.


Creating files properly

Instead of creating folders and then files, you can use the Window in order to create the file properly

More info here


Inspections

// RUN INSPECTIONS // RUN INSPECTIONS BY Name // Inspect code –> inspect code in our entire code

You can also enable inspections for a certain code pattern, for example using Structural search and enable quick fixes for those pieces of code.

https://youtu.be/Y2GC6P5hPeA?t=494


Test RESTful Web Service

Allows you to basically any calls to any endpoint http


Increasing IDE Memory

By default, the IDE is assigned a maximum of 750 MB. If you want to increase the IDE memory, you should place a studio.vmoptions file in the following directory (using MAC OS):

~/Library/Preferences/{FOLDER_NAME}/studio.vmoptions

and add -Xmx4096m. This lets the IDE take as much as 4MB of Ram for its operations. If you need to tweak other memory options, these are the flags you should modify:

-Xms512m
-Xmx4096m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCompressedOops

More info here


Changing idea properties

If you want to override an IDE property, create a new idea.properties file in the following directory (using MAC OS):

~/Library/Preferences/{FOLDER_NAME}/idea.properties

where you specify just the override properties. This file will be merged with the default properties in the IDE.

More info about properties that could be overriden, here and here


    - Scopes
        └── Build Out