Avoid AndroidX Jetifier log spam

566 Views Asked by At

I recently migrated my app to AndroidX and thus use the Jetifier tool (currently the version bundled with Android Gradle plugin version 3.3.0-alpha10):

# gradle.properties
android.useAndroidX=true
android.enableJetifier=true

It works fine, but adds many logs (for every library it transforms) like below throughout a build of my app and makes the logs hard to read.

It looks like this:

> Transform room-runtime.aar (androidx.room:room-runtime:2.0.0-rc01) with AarTransform
> Transform lifecycle-extensions.aar (androidx.lifecycle:lifecycle-extensions:2.0.0-rc01) with AarTransform
> Transform work-runtime.aar (android.arch.work:work-runtime:1.0.0-alpha08) with AarTransform

Is there any way to disable/ignore/filter these logs?

1

There are 1 best solutions below

5
On BEST ANSWER

Filtering out terminal/command line:

To filter-out output in terminal/command line use grep or some equivalent. On unix system it would go something like this:

./gradlew build | grep -vE 'Transform'

Windows grep's equivalent is findstr, so the whole command would look like this:

./gradlew build | findstr /V "Transform" 

Filtering out logcat:

If you have too any logs in the logcat, one possible solution is to filter-out all Jetifier's logs using the Android Studio log filters. You can do advanced filtering by clicking on the dropdown at the top right corner of Logcat menu and choosing Edit Filter Configuration and specifying what to filter on.

enter image description here

In your case the filter should look something like this. This configuration will filter-out all messages with 'Transform' tag (I'm not sure whether Transform is a tag or just a part of a message). enter image description here

Most likely you will want to create a more advanced configuration so that only logs from your package get to be displayed.