title: Unity ignores android plugin manifest file leading to missing <service> element in its android manifest
body: <p>I have created an Android plugin for Unity3D. This plugin starts a background service by calling <strong>bindService()</strong>. To declare this service, I have put the <code>&lt;service&gt;</code> element as a child of the <code>&lt;application&gt;</code> element in the AndroidManifest.xml file <strong>of my android module</strong>. Then I created a jar file from the module and put it in <strong>Assets\Plugins\Android</strong> folder. </p>
  
  <p>The problem is that the <code>&lt;service&gt;</code> element is missing in the AndroidManifest file created by Unity. why is that? </p>
  
  <p>Unity should have extracted my manifest from the jar file and have merged it with its own manifest file according to <a href="https://docs.unity3d.com/Manual/PluginsForAndroid.html" rel="nofollow noreferrer">Unity documentation</a>:</p>
  
  <blockquote>
    <p>You can drop pre-compiled Android library projects into the
    Assets->Plugins->Android folder. Pre-compiled means all .java files
    must have been compiled into jar files located in either the bin/ or
    the libs/ folder of the project. AndroidManifest.xml from these
    folders will get automatically merged with the main manifest file when
    the project is built.</p>
  </blockquote>
  
  <p>So the result manifest file should contain the <code>&lt;service&gt;</code> element (but it does not as said before).</p>
  
  <p>The following is my module and its manifest file:</p>
  
  <p><a href="https://i.stack.imgur.com/Ivvgn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ivvgn.png" alt="enter image description here"></a>
  I used the following gradle code (from <a href="https://stackoverflow.com/a/35431416/81306">here</a>) to convert the module into a jar file:</p>
  
  <pre><code>task createJar(type: Copy) {
      from('build/intermediates/bundles/default/')
      into('libs/jars/')
      include('classes.jar')
      rename('classes.jar', 'locationPlugin.jar')
  }
  </code></pre>
  
  <p><strong>Note</strong>: My question is not a  duplicate of <a href="https://stackoverflow.com/q/43293173/81306">this question</a>. I'm not making custom manifest and I'm not modifying the manifest made by Unity. <strong>My question is about why unity does not merge the manifest of my compiled module (.jar file) into its own manifest.</strong> </p>