Ionic 3 proguard can not obfuscating anything?

631 views Asked by At

Hi I am using proguard for my project. After building a release APK I can not see anything related to obfuscate code and I am beginner in proguard. What are the rules I need to put in my proguard-custom.txt according to installed plugins and what are the general rules for android?

Plugin-List

com-sarriaroman-photoviewer 1.2.4 "PhotoViewer"
cordova-plugin-android-permissions 1.0.0 "Permissions"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-document-viewer 0.9.13 "SitewaertsDocumentViewer"
cordova-plugin-fcm-with-dependecy-updated 2.4.0 "Cordova FCM Push Plugin"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-opener2 2.2.1 "File Opener2"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-filechooser 1.2.0 "File Chooser"
cordova-plugin-filepath 1.5.5 "cordova-plugin-filepath"
cordova-plugin-filepicker 1.1.6 "File Picker"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-proguard 2.2.0 "Cordova plugin ProGuard"
cordova-plugin-splashscreen 5.0.4 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"

proguard-custom.txt

 # For obfusacte searsource name
 -printmapping out.map

 -renamesourcefileattribute SourceFile
 -keepattributes SourceFile,LineNumberTable

 # Package name
 -repackageclasses ''
 -allowaccessmodification    

 -keep class com.ionicframework.cordova.webview.** { *; } 
 -keep class com.ionicframework.cordova.webview.*

 -keep class io.plaidapp.data.api.dribbble.model.** { *; }

 -adaptresourcefilenames
 -adaptresourcefilecontents

Expectation from proguard

  1. My src/pages code will be secure.
  2. Also src/assets and images, icons also secure.

After reading official and many blogs I can not figure out anything which can say this is the proguard general rules in ionic android.

1

There are 1 answers

1
Sven 31415 On

As stated on the website, "ProGuard is the open source optimizer for Java bytecode". But you want to obfuscate your Javascript/TypeScript code base. And this is not possible with this cordova plugin.

What you need is a Javascript obfuscator. Nevertheless an ionic app is merely a website and obfuscating your assets and pages is nearly impossible.