By default, when I change Build Variants
to release
I don't get any Logs on the logcat, but I do need to read release logs of my app, how can I enable this?
Go to Project Structure -> Facets -> “+” -> Android -> Select Project Logcat should now be visible.
Solution 1: Restarting your Android StudioIn your IDE Go to File > Invalidate Caches and Restart > Invalidate and Restart. This Solution will clear all the caches of Android studio IDE and restart it automatically, By the method, there are 80% change that Logcat will start work as before.
Add android:debuggable="true"
(default is false) to your Manifest inside the <application>
tag.
From the docs:
android:debuggable
Whether or not the application can be debugged, even when running on a device in user mode — "true" if it can be, and "false" if not.
respectively
You can disable debugging by removing the android:debuggable attribute from the tag in your manifest file, or by setting the android:debuggable attribute to false in your manifest file.
You may need to add the following to your build.gradle
file inside the android{...} tag:
lintOptions { checkReleaseBuilds false }
And as a side-note: Right on the device the Logs are always written, no matter if your application's debuggable is set to false or true. But via the LogCat in Android Studio it's only possible if debuggable is set to true. (Just tested this)
I do not like the other solution because then you are not testing how the App really is deployed.
A better solution is to open the Android Device Monitor where you can see the logs even when in release configuration with debuggable=false
.
Find it here:
Tools -> Android -> Android Device Monitor
Update:
Android Device Monitor was removed in Android Studio 3.2. However, it is still present in SDK, and you can use it to see the logs (it is located in $ANDROID_SDK/tools/
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With