Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art
Merging two different applications in one application. Back to Android Cookbook Home | Up to Chapter: Packaging, deploying and selling

Author: Shraddha Shravagi ('sshraddha')
In Published Edition? No
FormatLanguage: WikiFormat

Merging two different applications in one application.


If you have two different application say one is application and one is service layer then how to send them in one apk?


Hello, If your source code is an different application and your service is a completely different application and if you want to package them in a single application then using a jar is solution for you.


Here's how to do it. Create a new build.xml file in your service code.

<?xml version="1.0" encoding="UTF-8"?> <project name="ServiceManager" default="dist" basedir=".">

  <description>Android Sample Library</description>
  <property name="src" location="src" />
  <property name="bin" location="bin" />

  <target name="dist">
     <jar destfile="ServiceManager.jar" basedir="bin/">
        <include name="com/**" />
  	<copy file="ServiceManager.jar" tofile="../HelloApp/libs/ServiceManager.jar"/>


Add this file to your service code. Now this will automatically copy the jar to your project that u mentioned in the destination file. And in your destination project you can always refer to it directly as you use any other ajr.

See Also