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: 1,078
  • Screenshot4.png
    Screenshot4.png
    94.7 KB · Views: 664
Last edited:
There is a file winehq.sources:
john@Desktop:~$ cat /etc/apt/sources.list.d/winehq.sources
Types: deb
URIs: https://dl.winehq.org/wine-builds/ubuntu/
Suites: resolute
Components: main
Signed-By: /usr/share/keyrings/winehq.gpg

Should I just add the Architectures line to it and save it as per method A & do the 'Refresh...' steps possibly changing the Signed-by line or should I delete it followed by creating a winehq-resolute.sources file as per method A & do the 'Refresh...' steps?
I suggest you follow method A and do the "refresh".
Leave the Signed-by as your original entry.
 
apt now working without the Notice about 32 bit architectures and also Software Updater (in Ubuntu) app. However, when I start B4A it briefly showed that the Wine configuration was being updated. When I tried to use the top menu (e.g. File) it just displayed a black window when clicking any of the top menus: did the same when I waited or repeated the clicks.,
 
When I tried to use the top menu (e.g. File) it just displayed a black window when clicking any of the top menus: did the same when I waited or repeated the clicks.,
Ubuntu 26.04 "Resolute Raccoon" has dropped the native Xorg session option for the default GNOME 50 desktop
This is a Wine bug due to absent of Xorg in new version of Ubuntu. Wayland has bad support of Wine. You should not upgrade to the latest Ubuntu.
 
This is a Wine bug due to absent of Xorg in new version of Ubuntu. Wayland has bad support of Wine. You should not upgrade to the latest Ubuntu.
Do you know if WineHQ have any plans for Wine to work better with Wayland?
 
Do you know if WineHQ have any plans for Wine to work better with Wayland?
No, I am waiting for this good news to come, since many years. Hopefully the developers could get help from AI to solve it soon.

Try one of these:
Command used: WINEPREFIX=~/.wine_b4x winetricks d3d9=builtin
winetricks renderer=vulkan
winetricks renderer=gdi

and
WINEPREFIX=~/.wine_b4x winetricks d3d9=builtin d3d11=builtin dxgi=builtin
 
Last edited:
B4X:
#!/bin/bash

# Color definitions for logging
COLOR_RESET="\033[0m"
COLOR_GREEN="\033[32m"
COLOR_YELLOW="\033[33m"

log_info() {
     echo -e "${COLOR_GREEN}[INFO]${COLOR_RESET} $1"
}
log_warn() {
     echo -e "${COLOR_YELLOW}[WARN]${COLOR_RESET} $1"
}

# Extract Vulkan version (e.g., "1.3.268" or "1.4.304") if vulkaninfo is present
    VULKAN_VER=""
    if command -v vulkaninfo &>/dev/null; then
        VULKAN_VER=$(vulkaninfo 2>/dev/null | awk '/apiVersion/ { match($0, /[0-9]+\.[0-9]+(\.[0-9]+)?/); print substr($0, RSTART, RLENGTH); exit }')
    fi
    # Auto-detect Vulkan 1.3+ using mathematical evaluation
    if [ -n "$VULKAN_VER" ] && echo "$VULKAN_VER" | awk -F. '{ major=$1+0; minor=$2+0; if (major > 1 || (major == 1 && minor >= 3)) exit 0; else exit 1 }'; then
        log_info "Detected Vulkan version $VULKAN_VER (1.3+ requirement met). Installing DXVK..."
        winetricks -q dxvk renderer=gdi fontsmooth=rgb corefonts 2>/dev/null || log_warn "Some dependencies failed. B4X may still work."
    else
        if [ -n "$VULKAN_VER" ]; then
            log_warn "Detected Vulkan version $VULKAN_VER (Below 1.3 requirement). Forcing wined3d OpenGL fallback..."
        else
            log_warn "Vulkan not supported or vulkaninfo missing. Forcing wined3d OpenGL fallback..."
        fi
        winetricks -q d3d9=builtin d3d11=builtin dxgi=builtin renderer=gdi fontsmooth=rgb corefonts 2>/dev/null || log_warn "Some dependencies failed. B4X may still work."
    fi

B4A wont start, copy and paste above code to terminal. It will auto detect vulkan version and apply valid command.

I forked it. The if statement seems to work properly as i plugged in various version. All credit to AI.
 
Last edited:
B4X:
#!/bin/bash

# Color definitions for logging
COLOR_RESET="\033[0m"
COLOR_GREEN="\033[32m"
COLOR_YELLOW="\033[33m"

log_info() {
     echo -e "${COLOR_GREEN}[INFO]${COLOR_RESET} $1"
}
log_warn() {
     echo -e "${COLOR_YELLOW}[WARN]${COLOR_RESET} $1"
}

# Extract Vulkan version (e.g., "1.3.268" or "1.4.304") if vulkaninfo is present
    VULKAN_VER=""
    if command -v vulkaninfo &>/dev/null; then
        VULKAN_VER=$(vulkaninfo 2>/dev/null | awk '/apiVersion/ { match($0, /[0-9]+\.[0-9]+(\.[0-9]+)?/); print substr($0, RSTART, RLENGTH); exit }')
    fi
    # Auto-detect Vulkan 1.3+ using mathematical evaluation
    if [ -n "$VULKAN_VER" ] && echo "$VULKAN_VER" | awk -F. '{ major=$1+0; minor=$2+0; if (major > 1 || (major == 1 && minor >= 3)) exit 0; else exit 1 }'; then
        log_info "Detected Vulkan version $VULKAN_VER (1.3+ requirement met). Installing DXVK..."
        winetricks -q dxvk renderer=gdi fontsmooth=rgb corefonts 2>/dev/null || log_warn "Some dependencies failed. B4X may still work."
    else
        if [ -n "$VULKAN_VER" ]; then
            log_warn "Detected Vulkan version $VULKAN_VER (Below 1.3 requirement). Forcing wined3d OpenGL fallback..."
        else
            log_warn "Vulkan not supported or vulkaninfo missing. Forcing wined3d OpenGL fallback..."
        fi
        winetricks -q d3d9=builtin d3d11=builtin dxgi=builtin renderer=gdi fontsmooth=rgb corefonts 2>/dev/null || log_warn "Some dependencies failed. B4X may still work."
    fi

B4A wont start, copy and paste above code to terminal. It will auto detect vulkan version and apply valid command.

I forked it. The if statement seems to work properly as i plugged in various version. All credit to AI.
Your PR is approved and code is merged now.
 
Last edited:
For our future reference.

Yes, DXVK baseline requirements do shift upward over time as the project evolves.
Major DXVK updates periodically drop legacy hardware extensions in favor of newer Vulkan specifications. For instance, upstream DXVK development has already begun transitioning its baseline expectations toward Vulkan 1.4 features.
What This Means for Your Detection Logic:
If a future DXVK release officially bump its baseline requirement from Vulkan 1.3 to Vulkan 1.4:
Hardware with Vulkan 1.3 only: Installing that hypothetical future DXVK build on a Vulkan 1.3 system would cause it to fail or crash because the driver lacks the newer Vulkan 1.4 extensions.
Updating the script threshold: If DXVK ever updates its hard dependency to 1.4, you would simply update the threshold in your script's awk math from minor >= 3 to minor >= 4:

B4X:
# Example threshold update if DXVK moves to a Vulkan 1.4 requirement:
if [ -n "$VULKAN_VER" ] && echo "$VULKAN_VER" | awk -F. '{ major=$1+0; minor=$2+0; if (major > 1 || (major == 1 && minor >= 4)) exit 0; else exit 1 }'; then

Why your script is future-proof right now:​


By structuring your script around dynamic mathematical evaluation (major and minor split) rather than hardcoded text regex, you've ensured that adjusting the target version down the road only ever requires changing a single digit in your script!

Summary of Requirements:
DXVK 2.x series: Requires a Vulkan 1.3 capable driver.
DXVK 3.x series: Bumps the requirement up to Vulkan 1.4.
DXVK 1.x series (e.g., 1.10.3): Legacy branch, required only Vulkan 1.1.

Currently, running winetricks dxvk will not fetch DXVK 3.x.
winetricks defaults to downloading stable DXVK 2.x releases.
 
Last edited:
No, I am waiting for this good news to come, since many years. Hopefully the developers could get help from AI to solve it soon.

Try one of these:

winetricks renderer=vulkan
winetricks renderer=gdi

and
Just did the first set in Terminal:
B4X:
Executing cd /usr/bin
winetricks latest version check update disabled in the Debian package for privacy reasons.
You may enable it by setting WINETRICKS_LATEST_VERSION_CHECK=enabled or creating /home/john/.config/winetricks/enable-latest-version-check
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
------------------------------------------------------
warning: You appear to be using Wine's new wow64 mode. Note that this is EXPERIMENTAL and not yet fully supported. If reporting an issue, be sure to mention this.
------------------------------------------------------
Using winetricks 20250102 - sha256sum: 9df4af038f04c753f3b0b02817cf60a51d8eac32357d070c45dfd139b93bd3f5 with wine-11.0 and WINEARCH=win64
Executing w_do_call renderer=vulkan
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
------------------------------------------------------
warning: You appear to be using Wine's new wow64 mode. Note that this is EXPERIMENTAL and not yet fully supported. If reporting an issue, be sure to mention this.
------------------------------------------------------
Executing load_renderer vulkan
Setting Direct3D/renderer to vulkan
Executing wine C:\windows\syswow64\regedit.exe C:\windows\Temp\set-wined3d.reg
Executing wine C:\windows\regedit.exe C:\windows\Temp\set-wined3d.reg
john@Desktop:~$ winetricks renderer=gdi
Executing cd /usr/bin
winetricks latest version check update disabled in the Debian package for privacy reasons.
You may enable it by setting WINETRICKS_LATEST_VERSION_CHECK=enabled or creating /home/john/.config/winetricks/enable-latest-version-check
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
------------------------------------------------------
warning: You appear to be using Wine's new wow64 mode. Note that this is EXPERIMENTAL and not yet fully supported. If reporting an issue, be sure to mention this.
------------------------------------------------------
Using winetricks 20250102 - sha256sum: 9df4af038f04c753f3b0b02817cf60a51d8eac32357d070c45dfd139b93bd3f5 with wine-11.0 and WINEARCH=win64
Executing w_do_call renderer=gdi
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
------------------------------------------------------
warning: You appear to be using Wine's new wow64 mode. Note that this is EXPERIMENTAL and not yet fully supported. If reporting an issue, be sure to mention this.
------------------------------------------------------
Executing load_renderer gdi
Setting Direct3D/renderer to gdi
Executing wine C:\windows\syswow64\regedit.exe C:\windows\Temp\set-wined3d.reg
Executing wine C:\windows\regedit.exe C:\windows\Temp\set-wined3d.reg

and B4A now working Ok.

Would you advise setting WINETRICKS_LATEST_VERSION_CHECK=enabled (as shown in the above) in order to possibly update winetricks?
 
Just did the first set in Terminal:
B4X:
Executing cd /usr/bin
winetricks latest version check update disabled in the Debian package for privacy reasons.
You may enable it by setting WINETRICKS_LATEST_VERSION_CHECK=enabled or creating /home/john/.config/winetricks/enable-latest-version-check
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
------------------------------------------------------
warning: You appear to be using Wine's new wow64 mode. Note that this is EXPERIMENTAL and not yet fully supported. If reporting an issue, be sure to mention this.
------------------------------------------------------
Using winetricks 20250102 - sha256sum: 9df4af038f04c753f3b0b02817cf60a51d8eac32357d070c45dfd139b93bd3f5 with wine-11.0 and WINEARCH=win64
Executing w_do_call renderer=vulkan
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
------------------------------------------------------
warning: You appear to be using Wine's new wow64 mode. Note that this is EXPERIMENTAL and not yet fully supported. If reporting an issue, be sure to mention this.
------------------------------------------------------
Executing load_renderer vulkan
Setting Direct3D/renderer to vulkan
Executing wine C:\windows\syswow64\regedit.exe C:\windows\Temp\set-wined3d.reg
Executing wine C:\windows\regedit.exe C:\windows\Temp\set-wined3d.reg
john@Desktop:~$ winetricks renderer=gdi
Executing cd /usr/bin
winetricks latest version check update disabled in the Debian package for privacy reasons.
You may enable it by setting WINETRICKS_LATEST_VERSION_CHECK=enabled or creating /home/john/.config/winetricks/enable-latest-version-check
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
------------------------------------------------------
warning: You appear to be using Wine's new wow64 mode. Note that this is EXPERIMENTAL and not yet fully supported. If reporting an issue, be sure to mention this.
------------------------------------------------------
Using winetricks 20250102 - sha256sum: 9df4af038f04c753f3b0b02817cf60a51d8eac32357d070c45dfd139b93bd3f5 with wine-11.0 and WINEARCH=win64
Executing w_do_call renderer=gdi
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
------------------------------------------------------
warning: You appear to be using Wine's new wow64 mode. Note that this is EXPERIMENTAL and not yet fully supported. If reporting an issue, be sure to mention this.
------------------------------------------------------
Executing load_renderer gdi
Setting Direct3D/renderer to gdi
Executing wine C:\windows\syswow64\regedit.exe C:\windows\Temp\set-wined3d.reg
Executing wine C:\windows\regedit.exe C:\windows\Temp\set-wined3d.reg

and B4A now working Ok.

Would you advise setting WINETRICKS_LATEST_VERSION_CHECK=enabled (as shown in the above) in order to possibly update winetricks?
Winetricks is just an extra tool to make your life easier for configuring wine (the core engine). No harm to update it. I find it seldom have updates. I think updating won't break wine.
 
There is an update to support Wayland graphics driver.
I tested it to run on Ubuntu 26.04.1 LTS which is Wayland only and its runs without the black menu.
Give it a try.
 
🎯 Install B4A and B4J on Linux using Wine with a single, configurable script.

Supported distribution families:
  • Ubuntu / Linux Mint / Pop!_OS / Debian derivatives (via apt + WineHQ repo)
  • Arch / Manjaro / EndeavourOS / Garuda / CachyOS / Artix (via pacman, auto-enables [multilib])
  • Fedora / RHEL / Rocky Linux / AlmaLinux / CentOS Stream (via dnf; see other-distros/fedora) <--new added/not yet tested
 
While the script works on Ubuntu 26.04 LTS without the black menu, it is not recommended to use it with the recently release Ubuntu 26.10 which may bring back the black menu.
 
Back
Top