Webpack uglify crash



Everytime when I try to run this build command:

tns build android --bundle --env.aot --env.uglify --env.snapshot --release --key-store-path android_publish.keystore --key-store-password XXX --key-store-alias XXX --key-store-alias-password XXX --copy-to skslovanbratislava.apk

I will get this error:

FAILURE: Build failed with an exception.
* Where:

Build file '/Users/roman/Desktop/eSports/skslovanbratislava/platforms/android/build-tools/android-static-binding-generator/build.gradle' line: 284

* What went wrong:
Execution failed for task ':asbg:generateBindings'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 55s
Command ./gradlew failed with exit code 1

When I remove from build command uglification. It works.

Uglification in iOS is working for me.

Thank you for help


I don’t know why you are getting that, but I had issues creating a build with --env.uglify. In my case I solved it by not using the uglify option at all, and instead using webpack-obfuscator. Worked like a charm.



Thank you. Do you feel that app is faster?

Could you send me your webpack config please?

Thank you so much


I don’t know if it’s faster and if so by how much, since the --env.uglify option never worked. I could not get my project compile due to errors.
(Cannot declare a let variable twice)

I did not modify my webpack config file in any way after installing it. Per the webpack-obfuscator instructions, I simply added this line to my plugins section

new JavaScriptObfuscator ({
	rotateUnicodeArray: true
}, ['vendor.js']),

and included the plugin at the top of the config file

const JavaScriptObfuscator = require('webpack-obfuscator');

That’s all. And of course I omitted the use of the --env.uglify flag during build/run or otherwise.