For Android, automatically copy icons in AppIcons directory to res folder#29
For Android, automatically copy icons in AppIcons directory to res folder#29Paucey wants to merge 1 commit intospuder:mainfrom
Conversation
…e Android res directories
|
Not sure if the root AppIcons folder needs to exist, though, as it may be redundant. Is it being used anywhere else in the project? Honestly would not be offended at all if you didn't accept this pull request, it may be wholly unnecessary. Was good practice, at least haha |
|
I don't recall creating the AppIcons folder or any of the images in there. It probably was either an Xcode/android studio or react-native automation. I'm open to whatever is best practice. If you have tested this and it works for you I'm good to merge it. |
|
I did test it, it works. The AppIcons folder is a nice, central place to organize all of the icons. Though in the future if one isn't aware of it, one may be flabbergasted trying to change the icons in the android res folder and not understand why they keep getting overwritten when a build happens. So that might be not ideal - most people, I think, wouldn't expect the icons to be handled this way if they weren't explicitly told about it. So again, may be unnecessarily overcomplicating things. The only other danger I could see is that if the "AppIcons/android" folder is ever removed that the build would fail. But if that folder is removed for whatever reason this block of code would just need to be removed from the build.gradle file and all would be well again. So, re: best practice, there's tradeoffs. I'd say this would be fine as long as the way it's all setup is clearly documented, but I would understand if one didn't want it setup this way. |
|
The best solution may be to just remove the AppIcons folder if it's not really necessary, since for both iOS and android the icons need to be in specific folders within their respective directory structures. |
Added preBuild task to automate icon copying in gradle.build for Android.
Automatically copies the icons in the root AppIcons subdirectories (e.g., mipmap-mdpi, mipmap-hdpi, etc.) to the respective locations in the Android resources directory.
Basically centralizes the icons to AppIcons so that one doesn't need to update them in two places.
Doesn't change anything for iOS.
Also assumes the existence (and continued existence) of the AppIcons folder in the root directory, and the android subdirectory within.