How to extend build.gradle with proguard for Cordova (ionic 2) app

790 views Asked by At

We have an Ionic 2 app with cordova.

Google recommend to obfuscate code with proguard. To do it, we should modify build.gradle. But in the other hands, proguard is not really supported by cordova since since it use reflexion. And It look there is no information for that from ionic. But in facts we uses custom modules implemented in java for android and they don't use reflexion. So we would like to use proguard.

I already some research but I don't find complete answer on how to implement it in cordova. Sometimes they tell to modify build.gradle but it's a generated file. Sometimes, "create a hooks" but no more information..., etc.

For the moment I can copy the file proguard.txt with a hooks, and I can run proguard by modifying build gradle. But...

1) When I modify build.gradle, proguard run but nothing are obfuscated. How should I configure it ?

2) How can I extends build.gradle ? I know I can use a build-extras.gradle but I don't understand what I need to write inside.

Do you have any idea on how to implement proguard in a cordova app ? Or any complete tutorial for it ?

Regards,

0

There are 0 answers