Multiple Android Application Package .apk files from single source code

后端 未结 10 957
我在风中等你
我在风中等你 2020-12-02 06:29

I would like an Android build system procedure, command line or Eclipse, to generate several .apk files from a single source codebase. Some common reasons for this - having

10条回答
  •  忘掉有多难
    2020-12-02 07:17

    I'm generating 2 different APK's (demo and production) from one single source tree with 3 small modifications:

    1) I have public static final DEMO=true; //false; in my Application class and depending on that value I used to switch code between demo/production features

    2) There are 2 main activities, like:

    package mypackage;
    public class MyProduction extends Activity 
    {
        //blah-blah
    }
    
    package mypackage.demo;
    public class MyDemoActivity extends mypackage.MyProductionActivity
    {
        //blah-blah
    }
    

    3) And in the end 2 separate AndroidManifest.xml files which points to different launcher activities depending on demo/production switch

    I'm switching between 2 APK's manually, but see nothing difficult in writing small ANT task to switch between them automatically

提交回复
热议问题