2

After the 0.14.0 android gradle plugin upgrade my project stopped building with an error: Build script error, unsupported Gradle DSL method found: 'renderscriptSupportMode(). After checking the release notes at http://tools.android.com/tech-docs/new-build-system I made the necessary below changes:

Renamed a few properties to make things more consistent.
BuildType.runProguard                 ->  minifyEnabled
BuildType.zipAlign                    -> zipAlignEnabled
BuildType.jniDebugBuild               -> jniDebuggable
BuildType.renderscriptDebug           -> renderscriptDebuggable
ProductFlavor.renderscriptSupportMode -> renderscriptSupportModeEnabled
ProductFlavor.renderscriptNdkMode     -> renderscriptNdkModeEnabled 

After changing the above properties some of the errors went away, however I am still getting the bellow:

Could not find property 'zipAlignEnabled' on com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated

Has someone come across this error or let me know if I am missing something? Below is the snippet of the gradle.build that is causing the error.

if (variant.zipAlignEnabled) {
        def file = variant.outputFile
        def fileName = file.name.replace(".apk", "-" + majorCode + "." + minorCode + "." +miniCode + "-" +buildNumber+".apk")
        variant.outputFile = new File(file.parent, fileName)
    }
velval
  • 3,072
  • 36
  • 45

2 Answers2

5

Did you try:

if (variant.buildType.zipAlignEnabled) { ...

(Bonus): You also might run into trouble using:

variant.outputFile = ...

if so you might find the following link useful: Gradle warning: variant.getOutputFile() and variant.setOutputFile() are deprecated

Community
  • 1
  • 1
ITJscott
  • 522
  • 4
  • 17
  • 2
    I had to use variant.outputs[0].outputFile – Lo-Tan Dec 05 '14 at 17:39
  • 1
    thanks @ITJscott, I realised shortly after I posted my question I needed to changed variant.outputFile to variant.outputs.each. I tried **variant.buildType.zipAlignEnabled** and it worked :) . thx again – velval Dec 09 '14 at 03:35
  • 1
    @Lo-Tan **variant.outputs[0].outputFile** will work fine if your build script only outputs one file, or you know for certain the first variant is the one you want. However the solutions in the above link show how to iterate through the 'variant' collection, allowing for both single or multiple output files. – ITJscott Dec 22 '14 at 14:17
0

you need to do couple of things to migratte from 0.9 to 1.0 see http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0

Netero
  • 3,761
  • 2
  • 29
  • 29