When we have added the trace library to our application, it will block on startup until it can connect to the trace receiver of Android Studio. That means you need to remove the trace library when you are done with the profiler, since it will lead to a useless render.
In order to start a trace, just run and deploy your application. A blank screen will first be prompted while it is waiting for the trace receiver to connect. To enable it, go to the CPU/GPU tab of the DDMS, and click on the red trace button, which you can find on the left side of the GPU tab ().
When the tracing starts, the application unlocks and we can interact with it. When we are done with the tracing, we need to click on the trace button again to stop the tracing process. When the file has been written, it will be opened.