Siddharth
Siddharth

Reputation: 9574

Building 2 applications from same codebase

I need to build to different applications from the same codebase. The first application has a feature to provide carpool's, and the second application has features to search and register to carpools. Now both these applications need to be different. Their entry point is all I need to be different. Is there a way to provide a build time option to change the Intent-Filter during launch ?

There are many suggestions for creating jar's for common functionality. But I dont want to do it like that. Is there any other way ?

Upvotes: 0

Views: 160

Answers (2)

Aiden Fry
Aiden Fry

Reputation: 1682

Yes, Create two manifest files. Compile using Maven (I assume you could use Ant too for this) Create two profiles. Set the manifest depending on the profile.

ie.

pom.xml

 <profile>
     <id>Target1</id>
     <properties>
        <customerManifest>Target1Manifest.xml</customerManifest>
      </properties>
      </profile>
 <profile>
     <id>Target2</id>
     <properties>
        <customerManifest>Target2Manifest.xml</customerManifest>
      </properties>
      </profile>

<plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <androidManifestFile>${customerManifest}</androidManifestFile>
                    <sdk>
                        <platform>15</platform>
                    </sdk>

            </plugin>

This switches out the manifest so you can set your seperate entry points.

Upvotes: 1

jtt
jtt

Reputation: 13541

This requires factoring your code in such a way that it can be configurable at build time. This often times would require programatic files (manifest, java files, build files, etc...) editing of certain files to work with build time.

Upvotes: 1

Related Questions