Android projects in Delphi have a lot of under the hood stuff to compile and debug Firemonkey applications on the devices.
This means that the normal DCUs are joined with a host of other files before producing the .apk file for deployment.
•Issues in compiling or linking because some files (eg .so) cannot be overwritten and may need manually deleting.
•Not being able to update the application due to an existing one with the same package name. (Use -cleaninstall)
•Worth looking at Troubleshooting on the dockwiki
•A Template Manifest file is used to construct the Android manifest. Some sample projects edit the Template (eg replacing the <%service%> tag with the special service entry required for the project or in the case of Kastri merging manifests as part of a post Build event .
•Build updates the files in the Android/Debug directory but the files in the Android/Debug/PackageName change only when "Packaged" and Installed.
•Some Android permissions are declared in the Delphi derived Manifest by default but if you need to add others you check them in Project > Options > Application > Uses Permissions and if they are "Runtime" permissions add code to request them.
•There seems to be some issue with projects created with another version of Delphi.
•Package name default is com.embarcadero.$(ModuleName) where module name = project name?
•Package label default is $(ModuleName) if the package label is set and the project is renamed it is possible to have duplicated installed packages labels.
When it comes to services this becomes even more confusing especially if you rename or re factor the service application.
•Service Modules do not have "Forms" appearing in the Options>Application>Forms Dialog however they do require a service module to be created "Application.CreateForm(TNoIntSrvDM, NoIntSrvDM);" in the Project source (.dpr) file
•Building application can stop with a long failed build command. This can be caused by left over entries in the Android Application Libraries Tag. Choosing to "Remove Android Services" does not clear .jar entries in libraries. This has to be done manually.
•Application stalls on Exception.
•Cannot put fmx components on data module (Eg Timer). It Introduces FMX.Types which breaks the service. Application stalls before main form opens. FMX.Types has a considerable Initialization section. Including it in the service compile results in TPlatformAndroid.BindAppGlueEvents being called twice and the second call generates a segmentation error.
•This extends to FMX.Objects and FMX.Grarhics which in turn call FMX.Types
•For services the Current Context can be obtained via TAndroidHelper.Context because MainActivity uses FMX.Platform.Android which in turn calls FMX.Types it also causes a crash.
•If you wish your service app to run in foreground when the host app closes you need to set android.permission.FOREGROUND_SERVICE.
Note: If the developer has changed the <SERVICE-NAME>.template.java file (local template file), and the JavaClasses folder from the root folder of an Android Service folder generated by a previous product release, it is very important to introduce the same changes into the local template file generated by RAD Studio 10.4.