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

Enable enableProguardInReleaseBuilds in build.gradle #567

Closed
NickIliev opened this issue Sep 21, 2016 · 4 comments
Closed

Enable enableProguardInReleaseBuilds in build.gradle #567

NickIliev opened this issue Sep 21, 2016 · 4 comments
Assignees
Milestone

Comments

@NickIliev
Copy link

From @ansarizafar on September 21, 2016 13:7

It seems that current build setup for android is not using Proguard. Please enableProguardInReleaseBuilds for release build to shrink the size of APK.

Copied from original issue: NativeScript/NativeScript#2782

@Plamen5kov
Copy link
Contributor

Hi @ansarizafar,
We have provided an <app_name>/app/App_Resources/Android/app.gradle file, for the purpose of changing the native configuration of a NativeScript project. You can enable proguard just as described in the official documentation, but there is a reason we haven't enabled it by default:

  • Most of the optimizations of proguard come from the fact it excludes classes, it sees as unnecessary and renames methods and classes.
  • Because of the nature of NativeScript, currently we need to call and create classes and call methods at runtime, and to do that we use their full qualified names. There is a way to customize proguard to keep certain classes (look under Customize which code to keep in the docs)

Having said that, I managed to make a working example of the hello world application and the final results were:

  • no proguard / debug (13.1 mb)
  • with proguard enabled / debug (12.7 mb)

This result is understandable, because nativescript doesn't contain a lot of java code to begin with.

@Plamen5kov Plamen5kov added this to the 2.4.0 milestone Oct 25, 2016
@Plamen5kov
Copy link
Contributor

I'm closing this issue, because anyone that wants to use proGuard can do it. The configuration possibilities are in place.

@priyangamani
Copy link

Warning: Exception while processing task java.io.FileNotFoundException: D:\sourc
ecode\fc\NativeScript\platforms\android\build\intermediates\proguard-rules\F0F
1F2F3F4F5F6F7F8F9F10F11F12F13F14F15\release\aapt_rules.txt (The system cannot fi
nd the path specified)
:transformClassesAndResourcesWithProguardForF0F1F2F3F4F5F6F7F8F9F10F11F12F13F14F
15Release FAILED

FAILURE: Build failed with an exception.

@priyangamani
Copy link

How to resolve the issues by using proguard in nativescript

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

No branches or pull requests

3 participants