New icons added to res in App_Resources causes full build every save
See original GitHub issueEnvironment
Provide version numbers for the following components (information can be retrieved by running tns info
in your project folder or by inspecting the package.json
of the project):
- CLI: 5.0.2
- Cross-platform modules: 5.0.5
- Android Runtime: 5.0.0
- iOS Runtime: n.a
- Plugin(s):
Describe the bug I recently added two new app icons which I had generated from AndroidAssetStudio. After copying the generated files from:
drawable-hdpi/
drawable-mdpi/
drawable-xhdpi/
drawable-xxhdpi/
drawable-xxxhdpi/
Into App_Resources/Android/src/main/res/
respectively, everytime I save a file it runs a full Gradle build of the project whereas before it only ran a “livesync” build. Not sure of the build type, but all I know is it used to be a few seconds between saving files (i.e., a typo) and now it takes at least a minute which severely drags dev time.
To Reproduce
- Go to AndroidAssetStudio and generate an icon set;
- Download icon set and unzip;
- Place the generated files into the matching
res/
folder withinApp_Resources
; - Run the application normally as
tns run android
- Save any file within the app;
- Note how it now says
Building project...
Expected behavior Instead of a full re-build of the application it should display the following:
Executing before-shouldPrepare hook from /Users/developer/git/obsidian/osm-client-native/hooks/before-shouldPrepare/nativescript-dev-webpack.js
Skipping prepare.
Successfully transferred app-routing.module.js on device 712KPDT1214194.
Refreshing application on device 712KPDT1214194...
Sample project
Additional context
I’ve tried determining a solution from these previous discussions:
- https://discourse.nativescript.org/t/i-lost-the-ability-to-incrementally-build-and-n-keeps-doing-full-builds/4265/2
- https://github.com/NativeScript/nativescript-cli/issues/3114
I’d like to add that if this is expected behavior it should be noted in the docs Action-Bar because as it stands it looks like you should be able to:
You can use local image (e.g., ~/images/add.png) or resource (e.g., res://ic_add). Because there is no way to explicitly set width and height for icons, the recommended approach is using resources.
I can confirm I can add an image via ~/images/add.png
but the image appears small and as stated I cannot customize that height, so instead I wanted to add my own resource res://
which worked, but at the cost of a full build every time I saved a file which should not be the case.
Thanks in advance! ~Px
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Hey @Manbearpixel ,
Thanks for providing the detailed logs. When a change is applied, CLI checks the state of the project to determine what it should do - just sync the current change or rebuild the application. Based on your logs, we have noticed (as you’ve already said) that CLI decides that the
App_Resources/Android/src/main/res/drawable-hdpi/receive_white.png
file is modified. This can happen due to two reasons (in case we know you have not modified it on your own):node -e 'console.log(require("fs").statSync("<path to receive_white.png>"))' && date
And send us the outputClosing due to inactivity.