docs: File createAndAddCustomizedAndroidManifestToSelendroidServer() throws IOException,
                                                                                       ShellCommandException,
                                                                                       AndroidSdkException {
      String targetPackageName = applicationUnderTest.getBasePackage();
  
      File tmpDir = Files.createTempDir();
      if (deleteTmpFiles()) {
        tmpDir.deleteOnExit();
      }
  
      File customizedManifest = new File(tmpDir, "AndroidManifest.xml");
      if (deleteTmpFiles()) {
        customizedManifest.deleteOnExit();
      }
      log.info("Adding target package '" + targetPackageName + "' to "
               + customizedManifest.getAbsolutePath());
  
      // add target package
      InputStream inputStream = getResourceAsStream(selendroidApplicationXmlTemplate);
      if (inputStream == null) {
        throw new SelendroidException("AndroidApplication.xml template file was not found.");
      }
      String content = IOUtils.toString(inputStream, Charset.defaultCharset().displayName());
  
      // find the first occurance of "package" and appending the targetpackagename to begining
      int i = content.toLowerCase().indexOf("package");
      int cnt = 0;
      for (; i < content.length(); i++) {
        if (content.charAt(i) == '\"') {
          cnt++;
        }
        if (cnt == 2) {
          break;
        }
      }
      content = content.substring(0, i) + "." + targetPackageName + content.substring(i);
      log.info("Final Manifest File:\n" + content);
      content = content.replaceAll(SELENDROID_TEST_APP_PACKAGE, targetPackageName);
      // Seems like this needs to be done
      if (content.contains(ICON)) {
        content = content.replaceAll(ICON, "");
      }
  
      OutputStream outputStream = new FileOutputStream(customizedManifest);
      IOUtils.write(content, outputStream, Charset.defaultCharset().displayName());
      IOUtils.closeQuietly(inputStream);
      IOUtils.closeQuietly(outputStream);
  
      // adding the xml to an empty apk
      CommandLine createManifestApk = new CommandLine(AndroidSdk.aapt());
  
      File manifestApkFile = File.createTempFile("manifest", ".apk");
      if (deleteTmpFiles()) {
        manifestApkFile.deleteOnExit();
      }
  
      createManifestApk.addArgument("package", false);
      createManifestApk.addArgument("-M", false);
      createManifestApk.addArgument(customizedManifest.getAbsolutePath(), false);
      createManifestApk.addArgument("-I", false);
      createManifestApk.addArgument(AndroidSdk.androidJar(), false);
      createManifestApk.addArgument("-F", false);
      createManifestApk.addArgument(manifestApkFile.getAbsolutePath(), false);
      createManifestApk.addArgument("-f", false);
      log.info(ShellCommand.exec(createManifestApk, 20000L));
  
      ZipFile manifestApk =
          new ZipFile(manifestApkFile);
      ZipArchiveEntry binaryManifestXml = manifestApk.getEntry("AndroidManifest.xml");
  
      File finalSelendroidServerFile = File.createTempFile("selendroid-server", ".apk");
      if (deleteTmpFiles()) {
        finalSelendroidServerFile.deleteOnExit();
      }
  
      ZipArchiveOutputStream finalSelendroidServer =
          new ZipArchiveOutputStream(finalSelendroidServerFile);
      finalSelendroidServer.putArchiveEntry(binaryManifestXml);
      IOUtils.copy(manifestApk.getInputStream(binaryManifestXml), finalSelendroidServer);
  
      ZipFile selendroidPrebuildApk = new ZipFile(selendroidServer.getAbsolutePath());
      Enumeration<ZipArchiveEntry> entries = selendroidPrebuildApk.getEntries();
      for (; entries.hasMoreElements(); ) {
        ZipArchiveEntry dd = entries.nextElement();
        finalSelendroidServer.putArchiveEntry(dd);
  
        IOUtils.copy(selendroidPrebuildApk.getInputStream(dd), finalSelendroidServer);
      }
  
      finalSelendroidServer.closeArchiveEntry();
      finalSelendroidServer.close();
      manifestApk.close();
      log.info("file: " + finalSelendroidServerFile.getAbsolutePath());
      return finalSelendroidServerFile;
    }