How to have both Debug and Release apk on same device?

后端 未结 5 724
眼角桃花
眼角桃花 2021-02-12 03:46

While continuing to develop my application and test it on a real phone, I need to have the release version of it on the same phone, for demonstration purposes (

相关标签:
5条回答
  • 2021-02-12 04:29

    You may want to try this technique using ant, Jenkins and perhaps other tools to automate package renames as suggested by @LAS_VEGAS.

    Although not what you asked for, this cool code snippet can help you find out at runtime whether your code is debug or release.

    Another interesting such attempt can be found in this thread. I am not sure though if it works on Android.

    0 讨论(0)
  • 2021-02-12 04:37

    The only way I know is to change the package name in your applications manifest file. Eclipse should handle all the code renaming for you.

    0 讨论(0)
  • 2021-02-12 04:37

    In Android Studio, Adding build variants using Product Flavours which can be easily customized for various environments and to test side by side multiple app variants of same app. Check out this link for more information - Configuring Gradle

    0 讨论(0)
  • 2021-02-12 04:40

    Use Android Studio because gradle make your life a lot easier - just use applicationIdSuffix

    android {  
       ...  
       buildTypes {  
         release {...}  
         debug {  
           applicationIdSuffix '.debug' 
         }  
       }  
    }
    

    For more go here.

    0 讨论(0)
  • 2021-02-12 04:40

    Could you put all your code in a Library Project and then just have two normal projects, that have different package names and just include the library project in both?

    This should keep all your code in one place. The normal projects would most likely only need a valid manifest file that points to the activities in the library project.

    0 讨论(0)
提交回复
热议问题