When using proguardLevel higher than ‘app’, we will need to add all Delegate to proguard rules. But it’s not that easy to find all those in your project especially when you come back to config for your proguard rules after you finish all your codes instead of doing that during your coding process. And it is possible to forget to add these rules later in the maintenance of the project. So I wrote this python script to verify the rules during gradle build.
Put the file in the same directory as your proguard.append.cfg as well as your src dir, or change the path in the script.
Then you could simply run ./proguardVerify.py and it will verify your proguard file and if you miss something, a file called ‘proguard.missing’ will be generated with all missing rules in it.
Or you may add a gradle task to let it verifies during the build:
The script will check every import in your java file, and looking for anything stars with ‘apple.’ and ends with ‘Delegate’.
Then it will check your proguard.append.cfg and find rules like: -keep interface apple.xxx.xxxDelegate { *; }
// Uncomment and change these settings if you are working with a Xcode workspace
// workspace 'xcode/Sample.xcworkspace'
// mainScheme 'Sample'
// testScheme 'Sample-Test'
}