To deploy an FMX application you need to configure the deployment settings for your project. This can get a little tedious when working with multiple platforms.
For example, if you want to deploy to an Android phone in debug and release mode for 64 bit, you have to configure settings for both debug and release. Now multiply that effort for each platform you choose to target:
- iOS Simulator
This is even more frustrating since you can’t copy configurations, or easily work with folders; each file has to be managed individually.
Fortunately, key files such as the AndroidManifest.Xml and application icons are automatically added to the various configurations by Delphi.
In this post, I’ll just walk through configuring deployment to Android 64 in Debug mode and offer a couple of troubleshooting tips at the end.
Open the Deployment Tool
You can launch the deployment tool from the project menu:
Configuration is quite simple, albeit tedious. You select a configuration, and then add files to deploy. When you click the Add Files button you will be prompted with a File Dialog. After selecting your files, you can configure their remote paths individually. For Android, you will typically set that to .\assets\internal\ which allows you to access the file at runtime like this:
Note: TPath is in the System.IOUtils unit.
This is the deployment tool being used to configure an Android 64-bit debug deployment:
Changes not Deployed
Occasionally, if you add a new file, or update an existing file, the changes may not be deployed. This appears to be an issue with caching. The solution is to Clean the project:
Build the project, click green Reconcile button in the deployment tool, then the Deploy button:
Next, make sure you have the correct configuration selected in the project explorer:
On the main toolbar, select your phone, then click run:
Changes still not Deployed
Sometimes, your changes may still not appear on the phone. In that case, completely uninstall the application from your phone, then click run.
If ever you get a deployment or build error indicating that the AndroidManifest.Xml file can’t be found, check that you haven’t accidentally set its remote path incorrectly. It should be:
as per this example:
I’ve noticed if you double click the remote path, sometimes .\assets\internal\ is selected accidentally.
Files still not Deployed
Lastly, make sure the file’s checkbox is checked or it won’t be deployed (see previous image).
I hope this tip helps.