0

I have encountered this problem several time whenever I update my Gradle version & Gradle Android plugin. For example, I used to use:

Gradle 2.1

Gradle Android Plugin com.android.tools.build:gradle:0.13.3

With this version, my build script contains for example:

buildTypes {
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), \
                          'proguard.cfg'
        }

        debug {
            runProguard false
        }

    }

Few weeks later, I saw a new Gradle version (2.2.1) was released, so, I updated my Gradle & Gradle Android Plugin to newer version:

Gradle 2.2.1

Gradle Android Plugin com.android.tools.build:gradle:1.0.0+

Then, I run command gradle clean build, suddenly, the build is not successful anymore, because with the newer version, I got error:

Could not find method runProguard()

My questions are:

  1. (MAIN QUESTION) It seems everytime when the Gradle & Gradle Android Plugin are updated, there are always some methods are deprecated, it is understandable. BUT, I am really appreciate if there is a document summarizes all the deprecated methods & their replacements. So, where can I find such information? Seems Gradle & Gradle Android Plugin don't do a good job on this to facilitate developers to quickly migrate the build script to newer version.

  2. How to get rid of the error: Could not find method runProguard() in my above case?

Leem.fin
  • 40,781
  • 83
  • 202
  • 354
  • Duplicate of [Gradle DSL method not found: 'runProguard()'](http://stackoverflow.com/questions/27016385/error26-0-gradle-dsl-method-not-found-runproguard) – Alberto Malagoli Dec 29 '14 at 13:43
  • @albemala, come on, my main question is to know where is the place to find out the replacements of deprecated methods in general when Gradle & Gradle Android Plugin are updated. Not only this specific case. It is not a duplicated question. – Leem.fin Dec 29 '14 at 13:47

3 Answers3

1

change

runProguard ****

to

minifyEnabled ****

you can get the deprecated methods or resources here http://tools.android.com/tech-docs/new-build-system for the android studio builds or releases

Ngoda
  • 92
  • 1
  • 9
  • Thanks, but I can't accept your answer now, as I really want to know where is the place to find out the replacements of deprecated methods in general when Gradle & Gradle Android Plugin are updated. Not only this specific case. – Leem.fin Dec 29 '14 at 13:45
1

I really want to know where is the place to find out the replacements of deprecated methods in general when Gradle & Gradle Android Plugin are updated

That would be the documentation, particularly the release notes. 0.14.0 renamed runProguard to minifyEnabled, and 0.14.3 removed runProguard.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

You should replace runProguard true with minifyEnabled true, there are a lot of question about this topic. On your first question, I read some official statement here saying that, from now on, they'll try to stick to actual methods name and/or provide support info, to make the switch between gradle versions easier, so you shouldn't be worried.

From version 1.0.0 and going forward, we will strive much harder to not make incompatible changes, and if we do, we plan to write IDE support to help migrate the projects automatically.

natario
  • 24,954
  • 17
  • 88
  • 158
  • http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0 this is what I was talking about. – natario Dec 29 '14 at 14:18