1

I want to add a couple of Environmental variables to my Android Studio Application code and I don't know how to do it. Specifically, I want to add AWS_ACCESS_KEY_ID with a String value. Should I put them in a specific file? in which file?

I know I can read it with System.getenv("AWS_ACCESS_KEY_ID"), however everything i try is getting null in the emulator. Thank you so much

After correctly setting the Environmental variables I would like to see the correct value in the emulator when I call: System.getenv("AWS_ACCESS_KEY_ID")

GustavoGB
  • 21
  • 4
  • 1
    Does this answer your question? [How to generate buildConfigField with String type](https://stackoverflow.com/questions/30796533/how-to-generate-buildconfigfield-with-string-type) – plplmax Mar 10 '23 at 21:13
  • "I know I can read it with System.getenv("AWS_ACCESS_KEY_ID")" -- no. Android does not have environment variables that you can set. – CommonsWare Mar 10 '23 at 21:59
  • @CommonsWare ok, I did not know that. I need to set the AWS keys, one method was to put the credentials in the environments but I see that it is not possible in Android, I will see if there is another more direct way – GustavoGB Mar 10 '23 at 22:02
  • 1
    Probably what you were reading was about putting them in your computer’s environment variables so you don’t have to check them into version control. So the link in the first comment will get you on the right track. – Tenfour04 Mar 11 '23 at 02:28
  • Thank you guys, I solved it simply with a method in which the keys are passed directly to it, thank you very much – GustavoGB Mar 11 '23 at 05:13

0 Answers0