Use the system log to output debug information (Associate Android Developer Certification)

This is example how you can use Log class to show logs.

public class MainActivity extends AppCompatActivity {

    final String LOG_TAG = "LogSandboxTag";

    protected void onCreate(Bundle savedInstanceState) {

        Log.e(LOG_TAG, "This is error");
        Log.w(LOG_TAG, "This is warning");
        Log.i(LOG_TAG, "This is info");
        Log.d(LOG_TAG, "This is debug");
        Log.v(LOG_TAG, "This is verbose");, "What a Terrible Failure!");


If you want to hide logs when release, you can do this in

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), ''
            buildConfigField "boolean", "USE_LOG", "false"
        debug {
            buildConfigField "boolean", "USE_LOG", "true"
        // Release with logs is inherited from release
        releaseWithLog {
            buildConfigField "boolean", "USE_LOG", "true"

If you want to show log in device use library called Galgo.