Android Tutorial [Linux] [B4X] Wine Installer

📦 Install B4A+B4J on Linux Mint using Wine with a single silent script​


GitHub: https://github.com/pyhoon/b4x-wine-installer


Files:
  1. install_b4x_wine.sh
  2. uninstall_b4x_wine.sh
  3. configure_b4x_settings.sh
  4. README.md
Archived:
  1. install_b4a_wine.sh
  2. install_b4j_wine.sh
  3. uninstall_b4a_wine.sh
  4. uninstall_b4j_wine.sh
  5. configure_b4a_settings.sh
  6. configure_b4j_settings.sh
  7. repair_b4a_launcher.sh
  8. repair_b4j_launcher.sh
The script is modified from the combination of B4A Wine Installer and B4J Wine Installer script generated by AI (Qwen3.6-Plus chat)
Using a single wine prefix saved you 3GB+ of diskspace.

Disclaimer: I haven't really fully tested it. Use it at your own risk.

🚀 How to use​

Just 3 lines of commands (You can copy and paste in one go).
Bash:
wget https://raw.githubusercontent.com/pyhoon/b4x-wine-installer/main/install_b4x_wine.sh
chmod +x install_b4x_wine.sh
./install_b4x_wine.sh

⚠️ Note / Reminder​

  1. When you double-click on a launcher (desktop icon), Linux Mint will prompt you to choose "Launch Anyway" or "Mark Executable". Choose the latter so it won't ask you again.
  2. Remember to comment the #CustomBuildAction: folders ready for RoboCopy.exe or Shared Files
  3. Even if you have run "configure_b4x_settings.sh", B4A still pops up asking you to set the Paths, just click "Ok" to save the settings.
  4. Make sure you have deleted old scripts and you are not downloaded the new script which renamed to .sh1 extension. Otherwise you are not executing the new script.
  5. Tips: To run winetricks, run winetricks prefix=.wine_b4x

🤝 Contributing​

Found an issue or have an improvement?
  1. Fork the repository
  2. Create a feature branch
  3. Submit a Pull Request

🙏 Credits​

Special thanks to B4X members who have contributed tutorial/guides in the past so that AI could use them as references to assist me to generate this script.
@Mihai Rainer Jr. @walt61 @Raboebie

📄 License​

MIT License - See LICENSE file for details.
 

Attachments

  • Screenshot3.png
    Screenshot3.png
    87.8 KB · Views: 894
  • Screenshot4.png
    Screenshot4.png
    94.7 KB · Views: 560
Last edited:

aeric

Expert
Licensed User
Longtime User
My understanding is, even latest version of Wine 11 is 64-bit, we can add 32-bit architecture
B4X:
sudo dpkg --add-architecture i386
which has already handled by the script before downloading the winehq key and source list.

Adding 32-bit support is only helping for installing .Net Framework 4.52 dependencies.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Finally worked out why Wine stable from WineHQ would not install. Some time back I did a rather stupid thing: I installed Ubuntu Pro (with ESM Apps, ESM Infra & Kernel Livepatch). I eventually realised my mistake and stupidly removed it in the wrong way (i.e. by merely disabling it in Ubuntu's 'Software & Updates). I've now re-enabled Ubuntu Pro and then removed it in the correct way. If anybody has done the same and wants to know how to do this, please contact me.

I have now installed B4A (including latest stable Wine from WineHQ) using the script referred to in post #1 and B4A works correctly.
 

johnaaronrose

Active Member
Licensed User
Longtime User
I installed B4A successfully using the script at the start of the thread. 3 things I noticed:
1. On starting B4A (e.g. by double clicking a B4A file for a project in Nautilus File Manager) there is a black window flash before the B4X coding is displayed. This doesn't really matter and I think that I've seen reference to it somewhere.
2. When I switch from B4A, when a popup such as Find/Replace is displayed, to another app (e.g. Firefox): I see the borders of the popup displayed. Is this due to Wine or something else? Again not a big deal.
3. Often (particularly if there is an error displayed by B4A) all the coding flashes (not just the bit where the error points to) and irritatingly the coding moves up and down a few lines. This irritation makes it difficult to correct coding and write new coding.
 

aeric

Expert
Licensed User
Longtime User
Updates:

Added​

  • Reinstall options— reinstall only the IDE(s) you choose without touching shared dependencies (Wine, Winetricks components, JDK 19, Android SDK):
    • CLI flags: --reinstall-b4a, --reinstall-b4j, --reinstall-all
    • Matching interactive menu entries: Reinstall B4A Only, Reinstall B4J Only, Reinstall B4A & B4J
    • Reinstall mode verifies Wine is present, creates the prefix only if missing, and still recreates desktop launchers.
  • Configuration output now shows Mode: Install or Mode: Reinstall, and the completion summary notes when dependencies were skipped.

Fixed​

  • WineHQ apt source no longer corrupted on Linux Mint— the root cause of E: Malformed entry 1 in sources file .../winehq.sources (Component):
    • get_ubuntu_codename() now prefers UBUNTU_CODENAME from /etc/os-release (Mint's lsb_release -sc returns the Mint codename, e.g. wilma, which WineHQ doesn't use); WINE_REPO_CODENAME override is respected as-is.
    • All log_info/log_warn/log_success output goes to stderr, so warning text can never be captured into CODENAME=$(...) and written into the sources file.
    • Codename is stripped of CR/whitespace and validated (^[a-z0-9]+$); invalid values abort with a clear message.
    • Generated winehq.sources is validated (Types/Suites/Components) before apt reads it; on validation or apt update failure the file is removed automatically so system apt is never left broken.
  • B4A-only install no longer aborts silently — download_file failures now print [!] Download failed: <url> and remove the partial file (previously wget -q failed silently under set -e, killing the script before the desktop launcher was created).
  • B4X resources step is non-fatal — download/extract failure only warns; B4A installs and the launcher is created regardless.
  • Silent unzip exits for the JDK and Android command-line tools now report a clear error instead of ending the script with no output.

Changed​

  • Existing B4A.exe / B4J.exe in drive_c/temp are removed before every download to guarantee a fresh installer.
  • Android commandlinetools zip (~136 MB) is downloaded only when SDK tools are actually missing — no re-download on every run and no leftover zip in temp on the skip path.
  • Added an "Extracting B4X resources…" progress message (extraction previously looked like a hang due to unzip -q).
  • Script header credits updated (Qwen3.6 Plus + MiMo-V2.6-Flash Free) and date bumped to 22 Sep 2026.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Updates:
https://www.b4x.com/android/forum/threads/linux-b4x-wine-installer.171136/

Added​

  • Reinstall options— reinstall only the IDE(s) you choose without touching shared dependencies (Wine, Winetricks components, JDK 19, Android SDK):
    • CLI flags: --reinstall-b4a, --reinstall-b4j, --reinstall-all
    • Matching interactive menu entries: Reinstall B4A Only, Reinstall B4J Only, Reinstall B4A & B4J
    • Reinstall mode verifies Wine is present, creates the prefix only if missing, and still recreates desktop launchers.
  • Configuration output now shows Mode: Install or Mode: Reinstall, and the completion summary notes when dependencies were skipped.

Fixed​

  • WineHQ apt source no longer corrupted on Linux Mint— the root cause of E: Malformed entry 1 in sources file .../winehq.sources (Component):
    • get_ubuntu_codename() now prefers UBUNTU_CODENAME from /etc/os-release (Mint's lsb_release -sc returns the Mint codename, e.g. wilma, which WineHQ doesn't use); WINE_REPO_CODENAME override is respected as-is.
    • All log_info/log_warn/log_success output goes to stderr, so warning text can never be captured into CODENAME=$(...) and written into the sources file.
    • Codename is stripped of CR/whitespace and validated (^[a-z0-9]+$); invalid values abort with a clear message.
    • Generated winehq.sources is validated (Types/Suites/Components) before apt reads it; on validation or apt update failure the file is removed automatically so system apt is never left broken.
  • B4A-only install no longer aborts silently — download_file failures now print [!] Download failed: <url> and remove the partial file (previously wget -q failed silently under set -e, killing the script before the desktop launcher was created).
  • B4X resources step is non-fatal — download/extract failure only warns; B4A installs and the launcher is created regardless.
  • Silent unzip exits for the JDK and Android command-line tools now report a clear error instead of ending the script with no output.

Changed​

  • Existing B4A.exe / B4J.exe in drive_c/temp are removed before every download to guarantee a fresh installer.
  • Android commandlinetools zip (~136 MB) is downloaded only when SDK tools are actually missing — no re-download on every run and no leftover zip in temp on the skip path.
  • Added an "Extracting B4X resources…" progress message (extraction previously looked like a hang due to unzip -q).
  • Script header credits updated (Qwen3.6 Plus + MiMo-V2.6-Flash Free) and date bumped to 22 Sep 2026.
I used the script at https://www.b4x.com/android/forum/threads/linux-b4x-wine-installer.171136/ to install B4A only (i.e. not B4J) under Ubuntu Noble. So I'm not familiar with the install parameters etc above. Could you be more specific as to what I should do to not have the irritations referred to in my previous post #43) on this topic?
 

aeric

Expert
Licensed User
Longtime User
I used the script at https://www.b4x.com/android/forum/threads/linux-b4x-wine-installer.171136/ to install B4A only (i.e. not B4J) under Ubuntu Noble. So I'm not familiar with the install parameters etc above. Could you be more specific as to what I should do to not have the irritations referred to in my previous post #43) on this topic?
In short, the updates added option to reinstall B4A/B4J only or both when new versions are released without reinstalling other packages such as wine, jdk and android sdk which you have already installed in previous version.

You don't need to run this script again if you have successfully install B4A.

My advice is use Linux Mint. Ubuntu may not a good choice for B4X IDE even though Linux Mint is based on Ubuntu, I think Linux Mint team has done some tweaks to make it runs more smoothly.
 

johnaaronrose

Active Member
Licensed User
Longtime User
In short, the updates added option to reinstall B4A/B4J only or both when new versions are released without reinstalling other packages such as wine, jdk and android sdk which you have already installed in previous version.

You don't need to run this script again if you have successfully install B4A.

My advice is use Linux Mint. Ubuntu may not a good choice for B4X IDE even though Linux Mint is based on Ubuntu, I think Linux Mint team has done some tweaks to make it runs more smoothly.
There is no way that I am switching from Ubuntu to Linux Mint. I've tried Linux Mint in the past and did not like it, amongst other reasons is that it's too much like Windows for my taste. BTW the only MS app that I use is B4A. Do you have any idea as to who to contact in the Linux Mint team to find out what these tweaks are?
 

aeric

Expert
Licensed User
Longtime User
There is no way that I am switching from Ubuntu to Linux Mint. I've tried Linux Mint in the past and did not like it, amongst other reasons is that it's too much like Windows for my taste. BTW the only MS app that I use is B4A. Do you have any idea as to who to contact in the Linux Mint team to find out what these tweaks are?
You can stay on Ubuntu. No problem.

Btw, I also didn't like Linux Mint but now I prefer it more than Ubuntu.
If you don't like the desktop environment (Mate, xfce or Cinnamon), you can customize it or use different one. You can install Gnome too.

Wine is the best option to run B4A. There are other options to run Windows only software.
You can try Bottle, WinBoat or VirtualBox.
 

johnaaronrose

Active Member
Licensed User
Longtime User
I'd still like to contact the appropriate person(s) in the Linux Mint team to find out about these tweaks from Mint so that I can put them in Noble. My assumption is that the tweaks would have been put into Linux Mint's version of Wine rather than into Linux Mint itself. Is that correct?
I've used VirtualBox before for other reasons. One issue is that I don't even have a copy of Windows. And I'm certainly not going to pay for one as well as the fact that I dislike using Windows and hate MicroShaft!
 

aeric

Expert
Licensed User
Longtime User
I'd still like to contact the appropriate person(s) in the Linux Mint team to find out about these tweaks from Mint so that I can put them in Noble. My assumption is that the tweaks would have been put into Linux Mint's version of Wine rather than into Linux Mint itself. Is that correct?
I've used VirtualBox before for other reasons. One issue is that I don't even have a copy of Windows. And I'm certainly not going to pay for one as well as the fact that I dislike using Windows and hate MicroShaft!
I don't think this is how it works.
I guess the difference between Linux Mint and Ubuntu is only on the desktop environment choice and version of software packages.
The kernel should be the same unless there is an update.

I am not sure about your hardware configurations because you didn't share them.

Some softwares work well on certain hardware, some don't.

As I already tested on both Ubuntu Noble and Linux Mint Zena.
Maybe my hardware works better. Maybe my configurations are we'll set.

It's hard to tell since we both may have different hardware and configurations.

One issue is that I don't even have a copy of Windows.
Maybe you can try WinBoat. It downloads Windows from the server.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Hardware and Config details are:
Minisforum PC
Ubuntu 24.04.5 64-bit fully up to date
AMD Ryzen 5 7545Ux12
Memory: 32 GB
Kernel: Linux 7.0.0-31-generic
Gnome 46
Windowing System: Wayland

I'll take a look at WinBoat.
 
Top