DON'T Use Base URLs Like THIS In Android

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024
  • Follow for more Android & Kotlin tips 🙌

ความคิดเห็น • 46

  • @allwin_5252
    @allwin_5252 ปีที่แล้ว +18

    I've been using this for a couple of years and It's convenient when you have multiple environments like staging, uat, and production with other API keys. You only need to switch the Build type and the base url, which will reflect the entire project.

  • @ryugalaw
    @ryugalaw ปีที่แล้ว +11

    PHENOMENAL!!!!
    It makes a lot of sense. I wouldn't want to clutter my code with things that depend on build variants. Thanks for the tip

  • @robchr
    @robchr ปีที่แล้ว +3

    You can also store the string in res and have a custom debug/res folder for non prod builds.

    • @GrahamFirst
      @GrahamFirst ปีที่แล้ว +2

      Or similarly, constants in code where you have different versions of the file under different source roots.

  • @aboutthat9930
    @aboutthat9930 ปีที่แล้ว

    Fun fact: There is a concept called build flavours, with this you can have one codebase and multiple build variants for different vendors, you can change everything and not just base urls and strings, you can totally change all the primary colors, images and much more specific to the variants.
    I once had a bill generator application, which later sold it to multiple small scale businesses using the flavours, any future modification can affect all the variants and each variant has their own logs, texts,colors etc..

  • @amit470
    @amit470 7 หลายเดือนก่อน

    This way I don't have to worry about the Base URL Thankyou mate it helped me a lot 🙂

  • @angelomarzocchi4202
    @angelomarzocchi4202 ปีที่แล้ว

    Man I love all your contents,every time a learn something new. Thanks for sharing !

  • @alyabdel-shafy250
    @alyabdel-shafy250 ปีที่แล้ว

    You can even use flavors to have multiple versions for your app, for example, staging environment and release environment, and you can have two version on same device

  • @the_nomadic_ajith
    @the_nomadic_ajith ปีที่แล้ว +1

    This a very basic thing. But yes, there are still people who does it the wrong way. Thanks for taking time to share this

    • @ArmandoClaudio
      @ArmandoClaudio ปีที่แล้ว +1

      It’s not “the wrong way” but a different less elegant way

  • @yuhenteng4694
    @yuhenteng4694 ปีที่แล้ว

    Very helpful, I will change my project's code after exam. Thanks for sharing ,phillip.

  • @hill_rider_HP31
    @hill_rider_HP31 ปีที่แล้ว

    Very nice tip, your videos always teach new things, 😄

  • @androidBossMahadi
    @androidBossMahadi ปีที่แล้ว

    Too helpful ☺️ Thanks @Philipp

  • @praveenselvakumarselvam4633
    @praveenselvakumarselvam4633 6 หลายเดือนก่อน

    Very useful

  • @baadrqaaba9529
    @baadrqaaba9529 3 หลายเดือนก่อน

    Awesome

  • @eriksobolev727
    @eriksobolev727 ปีที่แล้ว +2

    both types of base url are not so good. because it dont give you flexible for change test base url. usually on big projects you can have more than 1 base url for test servers. in debug and internal builds for testers we should have tools for write your own debug or test base url

  • @giocornejo2222
    @giocornejo2222 ปีที่แล้ว

    Finally, a content I'm already aware of haha

  • @quantumgaming7
    @quantumgaming7 ปีที่แล้ว

    Really helpful 😮

  • @shivagupta9858
    @shivagupta9858 ปีที่แล้ว

    Useful ✌️

  • @olivierloukombo2082
    @olivierloukombo2082 ปีที่แล้ว +2

    When someone tries to decompile your application, he won't see anything.

  • @royalanimations007
    @royalanimations007 ปีที่แล้ว

    Can you please provide a tutorial on mongodb Google auth with direct remote mongo database connection in compose kotlin

  • @ElamanAytymbet
    @ElamanAytymbet ปีที่แล้ว

    Please make more useful video like this

  • @Namesake..
    @Namesake.. หลายเดือนก่อน

    careful with the url for release... do test before shipping 😂

  • @JossEnssy
    @JossEnssy ปีที่แล้ว

    Esta información vale millones....

  • @rajeshbedi
    @rajeshbedi ปีที่แล้ว

    awesome tip

  • @Vihor95
    @Vihor95 ปีที่แล้ว

    Nice

  • @samislam2746
    @samislam2746 3 หลายเดือนก่อน

    Where are you from?

  • @Indently
    @Indently ปีที่แล้ว

    How do you do this in Python

  • @nuelzemudio883
    @nuelzemudio883 ปีที่แล้ว

    ..but the thing is, my gradle takes like a year to build anything.

  • @kiekiekiekiekiekie
    @kiekiekiekiekiekie ปีที่แล้ว

    are there any advantages over using debug/res ?

  • @mariotepe679
    @mariotepe679 ปีที่แล้ว

    How could you do this with Flavors?

  • @akshat860
    @akshat860 19 วันที่ผ่านมา

    I have to sync my build everytime i change it

    • @PhilippLackner
      @PhilippLackner  19 วันที่ผ่านมา

      How often do you change these that this is a problem lol

  • @samsadch
    @samsadch ปีที่แล้ว

    What if I want to give signed apk with debug URL?

    • @samsadch
      @samsadch ปีที่แล้ว

      This should be release also

  • @efeeeeee212
    @efeeeeee212 ปีที่แล้ว

    Actually I don't need that, it's not useful for my eyes 👀

  • @PSK005
    @PSK005 ปีที่แล้ว

    Useful ✌️