Add resource file to monaca project?
-
so, I would like to add some resource files to support OneSignal notification icons on Android
I put the icon files in the tree view under res/android/drawable-<size>/
I added this to my android platform sections
<platform name="android"> <resource-file src="/res/android/drawable-mdpi/ic_stat_onesignal_default.png" target="res/drawable-mdpi/ic_stat_onesignal_default.png" />
I get this error when building
Build Error: Error: Sandbox Exec Error: [ Error: Source path does not exist: /res/android/drawable-mdpi/ic_stat_onesignal_default.png ]
So, am i doing this completely wrong?
Thanks
-
@Matt-Nelson In Monaca projects, you can only make changes within
www
folder. For this reason, you need to use the cordova-plugin-copy-resources plugin to make changes to project files outside ofwww
folder. These changes will be effective after the build. In your case, please do as follows:-
Add cordova-plugin-copy-resources plugin into your project.
-
Within config.xml, change the following line:
<resource-file src="/res/android/drawable-mdpi/ic_stat_onesignal_default.png" target="res/drawable-mdpi/ic_stat_onesignal_default.png" />
to
<resource dest="res/drawable-mdpi/" src="www/images/ic_stat_onesignal_default.png" />
Note: You need to put your images source files within
www
folder such asimages
folder.This should fix your build issue.
-