Reputation: 6858
I'm writing a C/C++ Android app. One of the libraries I'm using prints additional debugging information depending on whether an environment variable is set. Is there's any way to set one?
I was hoping that the launch target could be configured with an environment variable in Android Studio. Under Launch Options, there's an option to provide flags to the am start
call but Activity Manager doesn't provide any way of setting an environment variable prior to launch.
Upvotes: 4
Views: 2937
Reputation: 10499
Include a wrap.sh file in your APK: https://developer.android.com/ndk/guides/wrap-script.html
This only works for debuggable APKs, but given that you want it for logging that's probably for the best anyway.
Upvotes: 5