2013-01-18 35 views
0

我需要從相同的代碼庫構建到不同的應用程序。第一個應用程序具有拼車功能,第二個應用程序具有搜索和註冊車廂的功能。現在這兩個應用程序需要不同。他們的切入點是我需要改變的一切。有沒有辦法在啓動期間提供構建時間選項來更改Intent-Filter?從相同的代碼庫構建2應用程序

有很多關於爲常見功能創建jar的建議。但我不想這樣做。有沒有其他方法?

+0

希望這有助於到u http://stackoverflow.com/questions/4188250/how-to-create-multiple-android-apps-from-one-code-base&http://developer.android.com/ training/multiple-apks/index.html –

+0

我已經度過了兩次,不,他們沒有解決我的問題。謝謝。 – Siddharth

回答

1

這需要將代碼分解爲可在構建時配置的方式。這通常需要編程文件(清單,Java文件,構建文件等)編輯某些文件以使用編譯時間。

+0

那麼像螞蟻一樣? – Siddharth

+0

Ant是用於構建一個堅實的選擇,但你需要程序上的文件編輯像Python /紅寶石。 – JoxTraex

+0

我想我可以避免它,並有一個更簡單的解決方案。在接受答案之前,我會等一會兒。再次感謝。 – Siddharth

1

是, 創建兩個清單文件。 使用Maven編譯(我假設你也可以使用Ant) 創建兩個配置文件。 根據配置文件設置清單。

即。

的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> 

此切換出來的清單,以便您可以設置單獨的入口點。

+0

所以當你構建調用mvn clean package -P TargetX –

相關問題