AndroidStudio 2.2 build gradle error ( path to custom proguard file )

previous installed AndroidStuio version was :2.1.3 but after update to 2.2 and update gradle, building gradle has a problem Because of the proguard name.

Before, for release .Apk i use a custom proguard config with this way:

  buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('fileName.txt')
    }
}

but after update AndroidStudio 2.1.3 to 2.2 this error occurs:

Error:(17, 0) User supplied default proguard base extension name is unsupported. 
Valid values are: [proguard-android.txt, proguard-android-optimize.txt]
Open File

Notice That : After update settings and config files imported from previous version And SDK folder path not chnage


old way!
Unfortunately and finally, I had to use old version of AndroidStudio(2.1.3) and this work but not is solution for AndroidStudio 2.2

Answer

way 1 :

After several tests I found that I should set complete path to proguard file like following config :

in build.gradle(module:app) :

 buildTypes {
    release {
        minifyEnabled true
        proguardFile ('FullPath/.../configFileName.txt')
    }
}

, and no need to using getDefaultProguardFile before path.

Too , you can paste your config file to ...appNameapp and chanage proguardFile to :

 proguardFile ('configFileName.txt')

Actually , default path is .../appName/app and if you put just configFileName , this will search file name in default project path.

in previous version I had’t this problem and default gradle path was ...SDKtoolsproguard


update

way 2 : in below image and step 4 you can browse and select ProguardFile for debug or release

enter image description here

And in build.gradle(module:app) file , ProguardFile path will add automatically