on Android the interface is exposed via Libcore.os as a kind of hidden API.
Libcore.os.setenv("VAR", "value", bOverwrite);
Libcore.os.getenv("VAR"));
The Libcore class as well as the interface OS is public. Just the class declaration is missing and need to be shown to the linker. No need to add the classes to the application, but it also does not hurt if it is included.
package libcore.io;
public final class Libcore {
private Libcore() { }
public static Os os;
}
package libcore.io;
public interface Os {
public String getenv(String name);
public void setenv(String name, String value, boolean overwrite) throws ErrnoException;
}