Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing log and optimization doesn't work #27

Open
Kohagan91 opened this issue Jul 29, 2021 · 1 comment
Open

Removing log and optimization doesn't work #27

Kohagan91 opened this issue Jul 29, 2021 · 1 comment

Comments

@Kohagan91
Copy link

Hi,

I'm currently working on a Cordova android app and I think your plugin can help me.

Unfortunately when I'm trying to remove logs (verbose and debug) in my release build. It seems doesn't work at all.

The issue is in build.gradle. The usage of "proguard-android.txt" instead of "proguard-android-optimze.txt".

In android sdk you can found difference between them here :
proguard-android-optimze.txt
proguard-android.txt

As writing in proguard-android.txt in commentary :
|# Optimization is turned off by default. Dex does not like code run |# through the ProGuard optimize and preverify steps (and performs some |# of these optimizations on its own). |# Note that if you want to enable optimization, you cannot just | # include optimization flags in your own project configuration file; | # instead you will need to point to the | # "proguard-android-optimize.txt" file instead of this one from your | # project.properties file.

and in ProGuard documentation :

-assumenosideeffects : Only applicable when optimizing. In general, making assumptions can be dangerous; you can easily break the processed code. Only use this option if you know what you're doing!

So three possibilities are available for this project :

  • Remove all rules from proguard-custom.txt that are not applicable.
  • Create an argument or option of the plugin to use one or another default ProGuard configuration
  • Change in build.gradle to use in release mode "proguard-android-optimze.txt"

Thanks in advance for your return, I can create a PR if needed

@greybax
Copy link
Owner

greybax commented Jul 29, 2021

Thank you @Kohagan91 for finding this issue and suggestions to resolve it.

So three possibilities are available for this project :

  • Remove all rules from proguard-custom.txt that are not applicable.
  • Create an argument or option of the plugin to use one or another default ProGuard configuration
  • Change in build.gradle to use in release mode "proguard-android-optimze.txt"

Actually, I would suggest going with the 2nd option, since it's more flexible and configurable. For example add --optimize param

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants