Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

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?


  • Monaca

    @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 of www folder. These changes will be effective after the build. In your case, please do as follows:

    1. Add cordova-plugin-copy-resources plugin into your project.

    2. 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" />


      <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 as images folder.

    This should fix your build issue.