Debugging your project

It's crucial that you thoroughly test your app for bugs before releasing it. Android Studio provides a range of tools that you can use to debug an app running on an emulator or a physical Android device, although these tools can only test a debuggable version of your app, which means you'll need to run your app in debug mode.

To run your app in debug mode, open your project's module-level build.gradle file and add the following:

apply plugin: 'com.android.application' 
 
......... 
 
......... 
  } 
   buildTypes {  
          debug {  
                  debuggable true 
            }  
    }  
} 

After editing your Gradle build file, make sure you sync your project. Next, click the Debug icon or select Run from the Android Studio toolbar, followed by Debug.

Select the AVD or physical Android ...

Get Android UI Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.