0

Usually I turn on --info to see proguardRelease's output or to see why a certain task did or didn't execute.

When I run assembleRelease with --info I get a huge spam from dexRelease containing thousands of lines like:

processing archive I:\build\intermediates\classes-proguard\release\classes.jar...
processing android/support/v7/appcompat/R.class...
ignored resource META-INF/LICENSE.txt
processing android/support/v4/app/Fragment.class...

I think those lines should be --debug level, but I don't know how to modify that. I'd like to have all other output as usual, but ignore the spam from dexRelease.

TWiStErRob
  • 44,762
  • 26
  • 170
  • 254

1 Answers1

0

I finally found a way to disable the dex output and just that (Android Gradle Plugin ~1.2):

import com.android.build.gradle.api.ApplicationVariant;
import com.android.builder.core.AndroidBuilder;
import java.lang.reflect.Field;

afterEvaluate {
    project.android.applicationVariants.all { ApplicationVariant variant ->
        if (!variant.dex) return;
        Field v = AndroidBuilder.class.getDeclaredField("mVerboseExec")
        v.accessible = true

        boolean originalVerbose;
        variant.dex.doFirst {
            originalVerbose = v.get(variant.androidBuilder)
            v.set(variant.androidBuilder, false)
        }
        variant.dex.doLast {
            v.set(variant.androidBuilder, originalVerbose)
        }
    }
}

It's a little hacky (reflection), but I found no public API to do this becuase the mVerboseExec value is initialized in the initialization phrase and the value is cached.

TWiStErRob
  • 44,762
  • 26
  • 170
  • 254