Adding package via npm to the project causes Error: Duplicate Resource on tns run

in #utopian-io7 years ago (edited)

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

  1. Create new NativeScript project
  2. Add any package with .js.map files (Steem for example npm i --save steem)
  3. Build app: tns run android
  4. 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

duplicate_res.png



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

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 problem

You can contact us on Discord.
[utopian-moderator]

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 60336.09
ETH 2333.36
USDT 1.00
SBD 2.53