JakeWharton/u2020

Unable to build productionRelease

matthewmichihara opened this issue · 5 comments

It looks like lint isn't happy with passing a raw number to res.getColor/getDimension

› ./gradlew assembleProductionRelease
:preBuild UP-TO-DATE
:preProductionReleaseBuild UP-TO-DATE
:checkProductionReleaseManifest
:preInternalDebugBuild UP-TO-DATE
:preInternalReleaseBuild UP-TO-DATE
:preProductionDebugBuild UP-TO-DATE
:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:prepareComAndroidSupportDesign2301Library UP-TO-DATE
:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:prepareComF2prateekRxPreferencesRxPreferences100Library UP-TO-DATE
:prepareComJakewhartonRxbindingRxbinding020Library UP-TO-DATE
:prepareComJakewhartonThreetenabpThreetenabp102Library UP-TO-DATE
:prepareComJakewhartonTimberTimber401Library UP-TO-DATE
:prepareComSquareupLeakcanaryLeakcanaryAndroidNoOp131Library UP-TO-DATE
:prepareIoReactivexRxandroid101Library UP-TO-DATE
:prepareProductionReleaseDependencies
:compileProductionReleaseAidl UP-TO-DATE
:compileProductionReleaseRenderscript UP-TO-DATE
:generateProductionReleaseBuildConfig
:generateProductionReleaseAssets UP-TO-DATE
:mergeProductionReleaseAssets UP-TO-DATE
:generateProductionReleaseResValues UP-TO-DATE
:generateProductionReleaseResources UP-TO-DATE
:mergeProductionReleaseResources UP-TO-DATE
:processProductionReleaseManifest UP-TO-DATE
:processProductionReleaseResources UP-TO-DATE
:generateProductionReleaseSources
:processProductionReleaseJavaRes UP-TO-DATE
:compileProductionReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:compileRetrolambdaProductionRelease
:compileProductionReleaseNdk UP-TO-DATE
:compileProductionReleaseSources
:lintVitalProductionRelease
/Users/mattm/Code/u2020/build/generated/source/apt/production/release/com/jakewharton/u2020/ui/MainActivity$$ViewBinder.java:19: Error: Expected resource of type color [ResourceType]
    target.statusBarColor = res.getColor(2131361859);
                                         ~~~~~~~~~~
/Users/mattm/Code/u2020/build/generated/source/apt/production/release/com/jakewharton/u2020/ui/trending/TrendingView$$ViewBinder.java:41: Error: Expected resource of type dimen [ResourceType]
    target.dividerPaddingStart = res.getDimension(2131099747);
                                                  ~~~~~~~~~~

   Explanation for issues of type "ResourceType":
   Ensures that resource id's passed to APIs are of the right type; for
   example, calling Resources.getColor(R.string.name) is wrong.

2 errors, 0 warnings
:lintVitalProductionRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lintVitalProductionRelease'.
> Lint found fatal errors while assembling a release target.

  To proceed, either fix the issues identified by lint, or modify your build script as follows:
  ...
  android {
      lintOptions {
          checkReleaseBuilds false
          // Or, if you prefer, you can continue to check for errors in release builds,
          // but continue the build even when errors are found:
          abortOnError false
      }
  }
  ...

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 15.452 secs

Does a clean build fix it?

This will be fixed in Butter Knife 8.

👍 fwiw, clean build does not fix it.

BTW we suppress this in lint.xml internally:

<lint>
  <!-- TODO: Re-enable when butterknife is updated -->
  <issue id="ResourceType" severity="Warning"/>
</lint>

This was suppressed on master for now.