Saeid Saeid - 1 month ago 63
Android Question

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

Finally test several way i found should set complete path to proguard file like below config :

in build.gradle(module:app)

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

, and not need to using getDefaultProguardFile before path.

Too , you can paste your config file to ...\appName\app and chnage gradle file to :

 proguardFile ('configFileName.txt')

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

in previous version i haven't this problem and default gradle path was ...\SDK\tools\proguard