How to pass a parameter to the Java code in run/debug configuration from Android Studio

后端 未结 4 2045
北海茫月
北海茫月 2021-02-04 12:47

My android app does some http requests to my server. However sometimes I am debugging the new api code that runs on my development machine. I would like to be able to pass somet

4条回答
  •  醉酒成梦
    2021-02-04 13:12

    I suggest using productFlavors. Each flavor can contain environment specific settings. I simply have a class called 'Environment' which contains all the public static final Strings that I need and each product flavor includes an different version of this class with the values set for the environment.

提交回复
热议问题