0

I change my ProGuard configuration depending upon the gradle build type. I do this so that I can magically disable certain code when creating a release build.

Example builds:

buildTypes {
    debug {
        minifyEnabled true
        proguardFiles 'proguard-debug.cfg'
    }
    release {
        minifyEnabled true
        proguardFiles 'proguard.cfg'
    }
}

Android Studio is content to add the proguard.cfg file to my Project View, but not the proguard-debug.cfg file.

Example Project View from my project (it shows my proguard config and from a library module, but not from my debug config).

project view in Android Studio

Structure of the directory:

project
-- .gradle
-- .idea
-- app (module)
-- -- src
-- -- Other files / folders
-- -- proguard-debug.cfg
-- -- proguard.cfg
-- -- proguard-release.cfg
-- Other files / folders
-- build.gradle
-- settings.gradle
Knossos
  • 15,802
  • 10
  • 54
  • 91
  • did you try moving your 'proguard-debug.cfg' to `release` section and then refresh the view? Also, move the 'proguard.cfg' to `debug`, does it disappear now? – Syed Ali Jun 14 '16 at 13:02
  • 1
    Could you explain what you mean by that? Moving the config file to `release`? – Knossos Jun 14 '16 at 13:13
  • I meant move the text to the release section of the gradle file eg: release { proguardFiles 'proguard-debug.cfg' } – Syed Ali Jun 14 '16 at 14:10
  • My problem is that I want both to appear. At the moment, only the one (debug) appears. The second ProGuard rule file in the image example (perhaps confusingly) is for another module entirely. (I don't want the files to disappear, I want them visible) – Knossos Jun 14 '16 at 14:26
  • Yes I understand that. What I wanted to find out is what happens when you replace the name of the file which is missing with the one which is appearing and vice versa? i.e. I want to find out if there is any relation between a file being mentioned in release/debug and its listing in the view. Although this clearly does not happen in my installation. – Syed Ali Jun 14 '16 at 14:33
  • buildTypes { debug { minifyEnabled true proguardFiles 'proguard.cfg' } release { minifyEnabled true proguardFiles 'proguard-debug.cfg' } } – Syed Ali Jun 14 '16 at 14:34
  • if you use the above in your gradle file - do you see any change in the files which you are able to view? – Syed Ali Jun 14 '16 at 14:35
  • No, no change to the list. – Knossos Jun 14 '16 at 15:48
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/114677/discussion-between-sttaq-and-knossos). – Syed Ali Jun 14 '16 at 21:27

0 Answers0