[java] How to print to the console in Android Studio?

I just downloaded Android Studio for Linux from: http://developer.android.com/sdk/installing/studio.html

I'm wondering how to print to the console?

Neither System.out.print(...) nor Log.e(...) from android.util.Log seem to work.

The answer is


Run your application in debug mode by clicking on

enter image description here

in the upper menu of Android Studio.

In the bottom status bar, click 5: Debug button, next to the 4: Run button.

Now you should select the Logcat console.

In search box, you can type the tag of your message, and your message should appear, like in the following picture (where the tag is CREATION):

enter image description here

Check this article for more information.


Android has its own method of printing messages (called logs) to the console, known as the LogCat.

When you want to print something to the LogCat, you use a Log object, and specify the category of message.

The main options are:

  • DEBUG: Log.d
  • ERROR: Log.e
  • INFO: Log.i
  • VERBOSE: Log.v
  • WARN: Log.w

You print a message by using a Log statement in your code, like the following example:

Log.d("myTag", "This is my message");

Within Android Studio, you can search for log messages labelled myTag to easily find the message in the LogCat. You can also choose to filter logs by category, such as "Debug" or "Warn".


Android Studio 3.0 and earlier:

If the other solutions don't work, you can always see the output in the Android Monitor.


android studio screen shot


Make sure to set your filter to Show only selected application or create a custom filter.

enter image description here


You can see the println() statements in the Run window of Android Studio.

See detailed answer with screenshot here.


I had solve the issue by revoking my USB debugging authorizations.

To Revoke,

Go to Device Settings > Enable Developer Options > Revoke USB debugging authorizations


If your app is launched from device, not IDE, you can do later in menu: Run - Attach Debugger to Android Process.

This can be useful when debugging notifications on closed application.


Be careful when using Logcat, it will truncate your message after ~4,076 bytes which can cause a lot of headache if you're printing out large amounts of data.

To get around this you have to write a function that will break it up into multiple parts like so.


Questions with java tag:

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error Instantiating a generic type When to create variables (memory management) java doesn't run if structure inside of onclick listener String method cannot be found in a main class method Are all Spring Framework Java Configuration injection examples buggy? Calling another method java GUI I need to know how to get my program to output the word i typed in and also the new rearranged word using a 2D array Java and unlimited decimal places? Read input from a JOptionPane.showInputDialog box Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable Two Page Login with Spring Security 3.2.x Hadoop MapReduce: Strange Result when Storing Previous Value in Memory in a Reduce Class (Java) Got a NumberFormatException while trying to parse a text file for objects Best way for storing Java application name and version properties Call japplet from jframe FragmentActivity to Fragment Comparing two joda DateTime instances Maven dependencies are failing with a 501 error IntelliJ: Error:java: error: release version 5 not supported Has been compiled by a more recent version of the Java Runtime (class file version 57.0) Why am I getting Unknown error in line 1 of pom.xml? Gradle: Could not determine java version from '11.0.2' Error: Java: invalid target release: 11 - IntelliJ IDEA Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Why is 2 * (i * i) faster than 2 * i * i in Java? must declare a named package eclipse because this compilation unit is associated to the named module How do I install Java on Mac OSX allowing version switching? How to install JDK 11 under Ubuntu? Java 11 package javax.xml.bind does not exist IntelliJ can't recognize JavaFX 11 with OpenJDK 11 Difference between OpenJDK and Adoptium/AdoptOpenJDK OpenJDK8 for windows How to allow all Network connection types HTTP and HTTPS in Android (9) Pie? Find the smallest positive integer that does not occur in a given sequence Error: JavaFX runtime components are missing, and are required to run this application with JDK 11 How to uninstall Eclipse? Failed to resolve: com.google.firebase:firebase-core:16.0.1 How to resolve Unable to load authentication plugin 'caching_sha2_password' issue

Questions with android tag:

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks Why am I seeing net::ERR_CLEARTEXT_NOT_PERMITTED errors after upgrading to Cordova Android 8? "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util No Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator WebView showing ERR_CLEARTEXT_NOT_PERMITTED although site is HTTPS WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' GoogleMaps API KEY for testing Can I use library that used android support with Androidx projects. How to allow all Network connection types HTTP and HTTPS in Android (9) Pie? Android Material and appcompat Manifest merger failed Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 How to format DateTime in Flutter , How to get current time in flutter? How to change package name in flutter? Failed to resolve: com.android.support:appcompat-v7:28.0 What is AndroidX? Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve FirebaseInstanceIdService is deprecated installation app blocked by play protect Handling back button in Android Navigation Component Android design support library for API 28 (P) not working Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Install Android App Bundle on device Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. How to develop Android app completely using python? Invoke-customs are only supported starting with android 0 --min-api 26 Flutter.io Android License Status Unknown How to open Android Device Monitor in latest Android Studio 3.1 Default interface methods are only supported starting with Android N How can I change the app display name build with Flutter? Error:(9, 5) error: resource android:attr/dialogCornerRadius not found error: resource android:attr/fontVariationSettings not found Flutter does not find android sdk Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0) Error : Program type already present: android.support.design.widget.CoordinatorLayout$Behavior flutter run: No connected devices Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 Still getting warning : Configuration 'compile' is obsolete and has been replaced with 'implementation' PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT (in windows 10)

Questions with mobile tag:

How to center a component in Material-UI and make it responsive? NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference Asus Zenfone 5 not detected by computer background: fixed no repeat not working on mobile Check box size change with CSS onClick not working on mobile (touch) Sharing link on WhatsApp from mobile website (not application) for Android Bootstrap 3 Slide in Menu / Navbar on Mobile How to create a link for all mobile devices that opens google maps with a route starting at the current location, destinating a given place? Using form input to access camera and immediately upload photos using web app How to print to the console in Android Studio? How can I simulate mobile devices and debug in Firefox Browser? Make an image responsive - the simplest way How to handle floats and decimal separators with html5 input type number PHP - Check if the page run on Mobile or Desktop browser Youtube autoplay not working on mobile devices with embedded HTML5 player How to implement swipe gestures for mobile devices? Responsive web design is working on desktop but not on mobile device How to create hyperlink to call phone number on mobile devices? @Media min-width & max-width Convert HTML5 into standalone Android App Div show/hide media query jQuery click event not working in mobile browsers Utility of HTTP header "Content-Type: application/force-download" for mobile? Disable scrolling in all mobile devices Twitter Bootstrap modal on mobile devices best practice font size for mobile scale fit mobile web content using viewport meta tag How to access a mobile's camera from a web app? Translating touch events from Javascript to jQuery What are the aspect ratios for all Android phone and tablet devices? How to detect a mobile device with JavaScript? What's the point of 'meta viewport user-scalable=no' in the Google Maps API Media Queries: How to target desktop, tablet, and mobile? :touch CSS pseudo-class or something similar? How to completely hide the navigation bar in iPhone / HTML5 Is there a kind of Firebug or JavaScript console debug for Android? Detect viewport orientation, if orientation is Portrait display alert message advising user of instructions position: fixed doesn't work on iPad and iPhone How can I edit a .jar file? How can I "disable" zoom on a mobile web page? Simplest way to detect a mobile device in PHP Removing address bar from browser (to view on Android) What is the best way to detect a mobile device? Blocking device rotation on mobile web pages Get GPS location from the web browser HTML5 <video> element on Android What is the difference between "SMS Push" and "WAP Push"?

Questions with development-environment tag:

ImportError: No module named 'encodings' How to watch and reload ts-node when TypeScript files change What's the difference between Docker Compose vs. Dockerfile VBoxManage: error: Failed to create the host-only adapter How to print to the console in Android Studio? Write to rails console Change a Rails application to production How do I set a path in Visual Studio? How can you program if you're blind?

Questions with android-studio tag:

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK Invoke-customs are only supported starting with android 0 --min-api 26 How do I convert 2018-04-10T04:00:00.000Z string to DateTime? How to open Android Device Monitor in latest Android Studio 3.1 flutter run: No connected devices Dart SDK is not configured PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT (in windows 10) Execution failed for task ':app:compileDebugJavaWithJavac' Android Studio 3.1 Update Android Studio AVD - Emulator: Process finished with exit code 1 Android Studio Emulator and "Process finished with exit code 0" How can I fix "Design editor is unavailable until a successful build" error? INSTALL_FAILED_USER_RESTRICTED : android studio using redmi 4 device Why AVD Manager options are not showing in Android Studio Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error) "The specified Android SDK Build Tools version (26.0.0) is ignored..." Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0 Getting error "The package appears to be corrupt" while installing apk file Android studio 3.0: Unable to resolve dependency for :app@dexOptions/compileClasspath': Could not resolve project :animators Gradle - Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0] Android Studio 3.0 Flavor Dimension Issue Android Studio - Failed to notify project evaluation listener error Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci Gradle error: Minimum supported Gradle version is 3.3. Current version is 3.2 Application Installation Failed in Android Studio Error:Failed to open zip file. Gradle's dependency cache may be corrupt Difference between signature versions - V1 (Jar Signature) and V2 (Full APK Signature) while generating a signed APK in Android Studio? Error:Cause: unable to find valid certification path to requested target How to switch from the default ConstraintLayout to RelativeLayout in Android Studio Installation failed with message Invalid File Warnings Your Apk Is Using Permissions That Require A Privacy Policy: (android.permission.READ_PHONE_STATE) error: package com.android.annotations does not exist 'Source code does not match the bytecode' when debugging on a device How to completely uninstall Android Studio from windows(v10)? How to show DatePickerDialog on Button click? You have not accepted the license agreements of the following SDK components Enable VT-x in your BIOS security settings (refer to documentation for your computer) "unable to locate adb" using Android Studio DELETE_FAILED_INTERNAL_ERROR Error while Installing APK Gradle Sync failed could not find constraint-layout:1.0.0-alpha2 This view is not constrained vertically. At runtime it will jump to the left unless you add a vertical constraint Android Studio Error: Error:CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running