Service based projects seem to have a problem with irrelevant data being left particularly in the .dproj file which then causes problems when compiling and packaging.
•When an application which uses a service is renamed or moves directories the information used to link the service is upset but some data seems to remain.
•Not all references are removed when using "Remove Android Service"
This shows up as extra information in the project file which in turn causes errors when compiling and packing the application. See Also Packaging issues
When the compiler stops with a "[Exec Error] The command ..." ....... "exited with code .." it seems it is often trying to include or execute files referenced by this left over data.
Solution
First try using the "remove Android Service" as it may take out some data. You then need to edit the dproj file.
Then delete all projectname files except projectname.dpr and projectname.dproj
The IDE does not allow editing of the .dproj files so I used Notepad, Notepad2 or notepad++.
Search for and remove all references to the libMyService.so and Myservice.jar files from the .dproj making sure you remove only complete xml tags
<DeployFile Include="..\Service\Android
>>>>>>>>>>>>>>>>>>>>>>>
</DeployFile>
<JavaReference Include="..\Service\Android\
>>>>>>>>>>>>>>>>>>>
</JavaReference>
Then
Build the service library
Build application without the service attached
- may need to add the service module manually but make sure the SMform is not auto created
Finally
Remove the service module from the application before trying to add the service
Then use "add Android Service"