How to remove debug info from compiled kotlin classes

379 Views Asked by At

Is there any way to make kotlin compiler stop adding debug info to compiled classfiles? Something like -g:none argument for javac?

1

There are 1 best solutions below

4
On

First you need to define the proguard rules on what you want and what you dont want in debug by seeting rules as given here if you have done step one then you will be able to see the code in the debug apk.

Second you need to open the Build Variants window. You can do this by hovering the mouse of the icon in the lower left corner of Android Studio and selecting Build Variants. Then to the right of the app module, click on "debug" and select "release" from the drop down list. Android Studio will now generate a release APK that does not have "debug" in the name.

Note that you will also need to create a keystore so that you can sign your app. Then you will need to configure Android Studio to use your keystore. See Sign Your App for more details about how to do this.