Skip to content

Instantly share code, notes, and snippets.

@rommansabbir
Created February 22, 2025 07:05
Show Gist options
  • Save rommansabbir/832978ddfa3f2ea2b99e03a1843a5113 to your computer and use it in GitHub Desktop.
Save rommansabbir/832978ddfa3f2ea2b99e03a1843a5113 to your computer and use it in GitHub Desktop.
ANDROID: Increase Logcat Buffer Size
/**
* Task: increaseLogcatBufferSize
*
* This Gradle task uses the Exec task type to execute an ADB command that increases the
* Android logcat buffer size to 16 megabytes (16M). This is useful when significant logging
* is enabled, ensuring that the log buffer does not truncate your logs during development
* and debugging.
*
* IMPORTANT:
* - Update the adb executable path in the commandLine() call to match your local environment.
* For example:
* - macOS/Linux: "/Users/yourusername/Library/Android/sdk/platform-tools/adb"
* - Windows: "C:/Users/yourusername/AppData/Local/Android/sdk/platform-tools/adb.exe"
*
* USAGE:
* Run this task from the command line:
* ./gradlew increaseLogcatBufferSize
*/
tasks.register<Exec>("increaseLogcatBufferSize") {
commandLine("/Users/romman/Library/Android/sdk/platform-tools/adb", "logcat", "-G", "16M")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment