Guidelines for using native code in MobileFirst projects
Follow these guidelines to keep the project's native code intact during a build.
As a rule, MobileFirst builds are non-destructive with respect to files in the native folder. The exception is the target web folder (meaning /www, or assets/www), which is overwritten during each build with the optimized web resources from common and environment-specific folders. Keep to the following rules to ensure that the native code remains intact during a build:
- If we have edited native code in either Android Studio or Xcode, ensure that the changes are under the app's native folder before the next build in MobileFirst Studio.
- We can safely place and edit non-web assets in the native folder. No duplication or copying of files under native to other locations occurs during a build.
- Additionally, we can place a limited number of assets (for example, icons) under the nativeResources folder that is then copied into the native folder during a build. However, make this the exception, rather than the rule.
- Never edit web assets directly in the native folder. Edit web assets in either the common or environment-specific folders, as appropriate. These folders are merged and optimized during a build and placed in the proper web target folder.
- Do not manually delete the native folder as it may contain critical custom code we have implemented. If we must delete the folder, first ensure we have backed up the code.
Parent topic: Web and native code in iPhone, iPad, and Android