Adding package via npm to the project causes Error: Duplicate Resource on tns run
Expected behavior
Project should successfully compile without any other modifications.
Actual behavior
tns will throw errors while compiling "Error: Duplicate Resource" and ultimately stop executing. This is due .js.map files being copied to platform and Android compiler doesn't differentiate between .js.map/.js.gz and .js files and treat them like they are equal.
How to reproduce
- Create new NativeScript project
- Add any package with .js.map files (Steem for example npm i --save steem)
- Build app: tns run android
- Watch for compile errors in console, right before Java throws compilation error there is merge assets error with Duplicate Resource message
Workaround:
After getting the error, go to platform/android and delete "duplicate" map/gz files from modules causing the issue.
- Browser:
N/A - Operating system:
Windows 10 1709 - Development software:
Node v8.9.4
JRE 8
NativeScript v3.4.1
tns-core 3.4.0
tns-android 3.4.1
Recording Of The Bug
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved because it is a duplicate. It is very similar to a contribution that was already accepted here.
Try using
tns build android --release
which might solve the problemYou can contact us on Discord.
[utopian-moderator]