Android Question B4A on linux (PCLINUXOS MATE) cannot install application with B4A bridge nor with USB cable.


Licensed User
installed B4A on linux according the forum example-instructions (for linux mint 64bit ) on pclinuxos mate 64bit.
B4A runs fine , all seems to work correctly with Wine .
B4A bridge installed on Ulefone Note 8 android works and is connected with B4A over wifi.
B4A status gives notification: Ulefone(Note8 ) connected.
(similar to B4A running on Windows 8 on same laptop where installation & debug works fine)
Compilation runs fine but get ADB error at the end in "Compile & Rapid Debug(Build: default)" window :
(last tree lines)
Signing package file (debug key). (1.87s)
Installing file to device. Error
adb.exe F 12-01 11:41:27 239 240 sysdeps_win32.cpp:2743] _wenviron is not set, did you link with -municode?

Tried also to compile and install with no wifi connection and usb cable connected on phone but gives same error.
I can read and connect to phone in pclinuxos file manager accordingly the settings for usb on phone.
I set USB to thethering (tried also file transfer ) before connecting and trying to install b4a application.

Both give the error :
adb.exe F 12-01 11:41:27 239 240 sysdeps_win32.cpp:2743] _wenviron is not set, did you link with -municode?

I have looked in the forum but do not get a good grip on that problem, had some issues the first time I installed B4A but resolved all these except this error.

What did I do wrong, overlooked or have to change in B4A settings?


Licensed User
Dear Mr Walt61,
thanks for your swift answer.
I did check it again and get in linux terminal adb --version : Android Debug Bridge version 1.0.40
In the Wine Command Prompt window I get in the dir D:\B4X\platform-tools\adb.exe --version : Android Debug Bridge version 1.0.40
(D: = /home/MY_USERNAME ) for Wine
This seems to be a correct install as is mentioned in the example-tutorial

When I run adb.exe in this Wine Command Prompt and ask for adb.exe devices
it gives :
List of devices attached
* daemon not running; starting now at tcp:5307
* daemon started succesfully

second time after that
adb.exe devices gives:
List of devices attached

On the other hand in the linux filemanger I get the connection the moment i switch the usb settings on phone to filetransfer .
It shows the phone name and all files (internal and SD-Card) can be viewed in the file manager.

When I try to install the application, with B4A bridge or USB cable, I still get in the "Compile & Debug Rapid(Build:default)" window the error:
adb.exe F 12-01 11:41:27 239 240 sysdeps_win32.cpp:2743] _wenviron is not set, did you link with -municode?

What is the relation between B4A and ADB and the _wenviron?
How to correct this with B4A or other way?
What does link with -municode means for ADB or B4A?

Thanks for your suggestions.
Upvote 0


Active Member
Licensed User
Hi @dinge ,

I'm afraid I have no idea (complete Linux n00b here and I haven't even had time to continue playing with it so far). I just remembered the -municode thing and found on the forum that it was related to the adb version.

That said, there is 1 possible difference with your installation and mine (again, no clue if that could be the cause): I used the Cinnamon desktop, and you appear to be using Mate?

Perhaps others can weigh in here, I know there are people in the community who use B4X on Linux on a daily basis.

Good luck!
Upvote 0


Licensed User
Dear Mr Walt61,
thanks for you reply . Possible. PCLINUXOS sticks to SystemV and ManDrake foundation.
Researched the error:
adb.exe F 12-01 11:41:27 239 240 sysdeps_win32.cpp:2743] _wenviron is not set, did you link with -municode?

sysdeps_win32.cpp seems to have to do with UTF16 to UTF8 conversion and back.
Here some code from this sysdeps_win32.cpp , marked the places where mentioned with '====>'
extern "C" int main(int argc, char** argv);
=====>     // Link with -municode to cause this wmain() to be used as the program
        // entrypoint. It will convert the args from UTF-16 to UTF-8 and call the
        // regular main() with UTF-8 args.
extern "C" int wmain(int argc, wchar_t **argv) {
        // Convert args from UTF-16 to UTF-8 and pass that to main().
        NarrowArgs narrow_args(argc, argv);
        return main(argc,;
        // Shadow UTF-8 environment variable name/value pairs that are created from
        // _wenviron the first time that adb_getenv() is called. Note that this is not
        // currently updated if putenv, setenv, unsetenv are called. Note that no
        // thread synchronization is done, but we're called early enough in
        // single-threaded startup that things work ok.
        static auto& g_environ_utf8 = *new std::unordered_map<std::string, char*>();
        // Make sure that shadow UTF-8 environment variables are setup.
    static void _ensure_env_setup() {
        // If some name/value pairs exist, then we've already done the setup below.
        if (g_environ_utf8.size() != 0) {
    if (_wenviron == nullptr) {
        // If _wenviron is null, then -municode probably wasn't used. That
        // linker flag will cause the entry point to setup _wenviron. It will
        // also require an implementation of wmain() (which we provide above).
====>   fatal("_wenviron is not set, did you link with -municode?");

Is there a file missing ( _municode trigger ?) to run properly in 64bit linux laptop and the wine configuration that has to do with the UTF-16 <-> UTF-8 thing ?

Strangely I renamed the adb.exe in the dir platform-tools from adb.exe to _adb.exe and when trying to compile install in B4A (connected with wifi - gives connected status on phone and B4A) to phone still gives the error as before. How is that possible, it should now give a missing file error, don't you think !

I've read in the forum that B4a-bridge does not use adb (??) why then this call to adb and error?

Is there a way to invoke from B4A (setting ) for B4A bridge to compile and debug and be sure it is not calling adb.exe, thus avoiding this error ?

Thanks for any suggestions.
Upvote 0