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.

Author: Shraddha Shravagi
Published? false
FormatLanguage: WikiFormat

Problem:

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

Solution:

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.

Discussion:

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/**" />
     </jar>
  	<copy file="ServiceManager.jar" tofile="../HelloApp/libs/ServiceManager.jar"/>
  </target>

</project>

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.

No records found.