Android Tutorial Running B4A and B4J under Linux with wine - fully functional

I have just managed to install B4A and make it run (including B4ASdkManager) on my Xubuntu 18.04 and, since I have lost two days and one night putting things together, I thought it will be a good idea to share it with this great community :)

Will assume that we have a partition for virtual drives on wine at /virtuals

1. Install last stable version of Wine (4.0) - x86 version
2. Install winetricks for easyer management, this short tutorial will rely on that
3. Create wine prefix for B4X applications:
Run in terminal, under your user, not root
WINEPREFIX="/virtuals/b4x" WINEARCH=win32 wine wineboot
4. Start winetricks:
Run in terminal, under your user, not root
WINEPREFIX="/virtuals/b4x" winetricks
5. Check "Select the default wine prefix" and click "OK"
(obsolete, not for wine 4.0) 6. Run winecfg and make sure Windows version is set to XP
6. Run winecfg and make sure Windows version is set to Windows 7
7. Check "Install a Windows DLL or component" and click "OK"
(obsolete, not for wine 4.0) 8. Check dotnet40 and vcrun2010, then click "OK"
8. Check dotnet452 and vcrun2010, then click "OK"
wait for install
9. Check "Run unistaller" and clikc "OK"
(obsolete, not for wine 4.0) uninstall all dotnet 4 apps and instances
uninstall all dotnet 452 apps and instances
10. Download dotnet 4.5.2 redistributable (offline version)
10'. Run winecfg and make sure Windows version is set to Windows 7 (because wine built-in dotnet installer switches this on Windows 2003)
11. Check "Run unistaller" and click "Install" button in that window, select new downloaded dotnet 4.5.2 installer
wait for the framework to install
12. Close all and restart the prefix
Run in terminal, under your user, not root,
WINEPREFIX="/virtuals/b4x" wineboot --restart
13. Also by using "Install" button in the window that appears when you select "Run uninstaller", install B4J
If you select "Launch B4J" the IDE should start.
14. Close the IDE
15. Same "Install" button - install JDK 8
16. Same procedure, install B4A
17. With winetricks, select "Change settings" and make sure you check:
glsl=enabled
ddr=gdi
videomemorysize=512 (don't know if really necessary)
orm=fbo
18. Close all
19. Go to your prefix folder, using a Linux terminal
cd /virtuals/b4x/drive_c/Program Files/Anywhere Software/Basic4Android and copy B4ASdkManager.jar to the directory where your java.exe was installed
20. Download android sdk-tools and unpack it manually in your prefix/drive_c/android-sdk directory, so you will have a "tools" directory under your prefix/drive_c/android-sdk
21. Go to the folder where your java.exe is and where you have copied B4ASdkManager
22. Run B4ASdkManager in a Linux terminal, with the command:
WINEPREFIX="/virtuals/b4x" wine ./java.exe -Xmx1G -Dprism.order=j2d -jar ./B4ASdKManager.jar
23. From the suggested installation things (already selected), deselect all lines referring to Intel x86 platforms and, also, all lines referring to Android emulator. Make sure you have at least 1G of free memory to allocate for java heap.
Some icons on some buttons are bigger than buttons, but, B4ASdkManager is still usable. On some points during the installation, it seems stalling, but, don't close it until it finishes (until the GUI becomes fully responsive again).
24. Close B4ASdkManager
25. Download latest android-tools for Linux and install them manually (I have simply copied adb to /usr/bin)
26. Check if adb is working
connect your android phone to the computer
Run in Linux terminal
adb devices
It must respond with something like:

List of devices attached
041c68157d25 device

if necessary, issue adb kill-server and adb -start-server, then, again, adb devices
27. Using a Linux terminal, go to
/virtuals/b4x/drive_c/Program Files/Anywhere Software/Basic4android
execute in terminal
WINEPREFIX="/virtuals/b4x" wine ./B4A.exe
Set the paths and configure your IDE upon your taste.
On compile & run, if you correctly installed adb, B4A will automatically detect it and upload your application.
If you have checked "Create icon on desktop" at installation stage, you will have a launcher on the desktop for B4J and B4A. At least on my Xubuntu 18.04 it works :)
Also, designer is fully functional, for both B4A and B4J.
Have fun with one of the greatest product, which is B4X suite :)

EDIT - tested and working with B4J 7.0
EDIT - tested and working with B4A 9.0
 
Last edited:

Sandman

Expert
Licensed User
Longtime User
Great work! I have a couple of questions:
  • You mention B4A and B4J, did you try to install B4i also?
  • You use adb to install app to mobile, did you also try to use the Bridge to install via network?
 

welu1805

Active Member
Licensed User
Longtime User
I tried it until #13 and selected "Launch B4J" but it doesn't start.

A shortcut on the desktop was created and when I double click I get the message:

B4J.exe - .NET Framework initialization ...
Please set registry key HKLM\Software\Microsoft\.NETFramework\InstallRoot to point to the
.NET Framework install location

What is to do?

Thanks
Lutz
 

welu1805

Active Member
Licensed User
Longtime User
Linux ubuntu 18.04 Mate 32 bit
wine 3.6
B4J 3.50
Created new partition (40GB) virtuals which is mounted as /media/lutz/virtuals.
Therefore WINEPREFIX="/media/lutz/virtuals/b4x"
 

Mihai Rainer Jr.

Member
Licensed User
The above procedure is for wine 3.18/3.20, with B4J 6.51.
Most probably, your B4J 3.50 requires other .NET version than described in the tutorial.
 

johnaaronrose

Active Member
Licensed User
Longtime User
I have just managed to install B4A and make it run (including B4ASdkManager) on my Xubuntu 18.04 and, since I have lost two days and one night putting things together, I thought it will be a good idea to share it with this great community :)

Will assume that we have a partition for virtual drives on wine at /virtuals

1. Install last development version of Wine (3.18) - x86 version
2. Install winetricks for easyer management, this short tutorial will rely on that
3. Create wine prefix for B4X applications:
Run in terminal, under your user, not root
WINEPREFIX="/virtuals/b4x" WINEARCH=win32 wine wineboot
4. Start winetricks:
Run in terminal, under your user, not root
WINEPREFIX="/virtuals/b4x" winetricks
5. Check "Select the default wine prefix" and click "OK"
6. Run winecfg and make sure Windows version is set to XP
7. Check "Install a Windows DLL or component" and click "OK"
8. Check dotnet40 and vcrun2010, then click "OK"
wait for install
9. Check "Run unistaller" and clikc "OK"
uninstall all dotnet 4 apps and instances
10. Download dotnet 4.5.2 redistributable (offline version)
11. Check "Run unistaller" and click "Install" button in that window, select new downloaded dotnet 4.5.2 installer
wait for the framework to install
12. Close all and restart the prefix
Run in terminal, under your user, not root,
WINEPREFIX="/virtuals/b4x" wineboot --restart
13. Also by using "Install" button in the window that appears when you select "Run uninstaller", install B4J
If you select "Launch B4J" the IDE should start.
14. Close the IDE
15. Same "Install" button - install JDK 8
16. Same procedure, install B4A
17. With winetricks, select "Change settings" and make sure you check:
glsl=enabled
ddr=gdi
videomemorysize=512 (don't know if really necessary)
orm=fbo
18. Close all
19. Go to your prefix folder, using a Linux terminal
cd /virtuals/b4x/drive_c/Program Files/Anywhere Software/Basic4Android and copy B4ASdkManager.jar to the directory where your java.exe was installed
20. Download android sdk-tools and unpack it manually in your prefix/drive_c/android-sdk directory, so you will have a "tools" directory under your prefix/drive_c/android-sdk
21. Go to the folder where your java.exe is and where you have copied B4ASdkManager
22. Run B4ASdkManager in a Linux terminal, with the command:
WINEPREFIX="/virtuals/b4x" wine ./java.exe -Xmx1G -Dprism.order=j2d -jar ./B4ASdKManager.jar
23. From the suggested installation things (already selected), deselect all lines referring to Intel x86 platforms and, also, all lines referring to Android emulator. Make sure you have at least 1G of free memory to allocate for java heap.
Some icons on some buttons are bigger than buttons, but, B4ASdkManager is still usable. On some points during the installation, it seems stalling, but, don't close it until it finishes (until the GUI becomes fully responsive again).
24. Close B4ASdkManager
25. Download latest android-tools for Linux and install them manually (I have simply copied adb to /usr/bin)
26. Check if adb is working
connect your android phone to the computer
Run in Linux terminal
adb devices
It must respond with something like:

List of devices attached
041c68157d25 device

if necessary, issue adb kill-server and adb -start-server, then, again, adb devices
27. Using a Linux terminal, go to
/virtuals/b4x/drive_c/Program Files/Anywhere Software/Basic4android
execute in terminal
WINEPREFIX="/virtuals/b4x" wine ./B4A.exe
Set the paths and configure your IDE upon your taste.
On compile & run, if you correctly installed adb, B4A will automatically detect it and upload your application.
If you have checked "Create icon on desktop" at installation stage, you will have a launcher on the desktop for B4J and B4A. At least on my Xubuntu 18.04 it works :)
Also, designer is fully functional, for both B4A and B4J.
Have fun with one of the greatest product, which is B4X suite :)
 

johnaaronrose

Active Member
Licensed User
Longtime User
I'm using Ubuntu 18.04. I think that the instructions at https://linuxconfig.org/install-wine-on-ubuntu-18-04-bionic-beaver-linux are Ok for installation of latest development version - x86 version. Am I correct?

I do not understand steps 8-11:
8. Check dotnet40 and vcrun2010, then click "OK"
wait for install
9. Check "Run unistaller" and clikc "OK"
uninstall all dotnet 4 apps and instances
10. Download dotnet 4.5.2 redistributable (offline version)
11. Check "Run unistaller" and click "Install" button in that window, select new downloaded dotnet 4.5.2 installer
wait for the framework to install

What is unistaller? Is it installer or uninstaller? I assumed that it was Uninstaller and removed .NET Extended & .NET Client Profile leaving Visual C. However, there was then no option to do step 10 (i.e. download .NET 4.5.2). I tried to install NET 4.5.2 by going back to Install Windows DLL or Component but it gave a window with "error: dotnet452 conflicts with dotnet40, which is already installed.". So I downloaded .NET 4.5.2 Redistributable Offline from https://www.microsoft.com/en-us/download/details.aspx?id=42642. I then tried to install it using the Install button in 'Add/Remove Programs" after selecting Uninstaller in Winetricks but after Extracting the files from NDP452...exe, it gave "The .NET Framework 4.5.2 is not supported on this operating system." This is not surprising given that the above Microsoft webpage does not give Windows XP (which you specified in step 6) as a supported OS. What should I do?
 
Last edited:

Mihai Rainer Jr.

Member
Licensed User
Using winetricks, check "Run uninstaller" and click OK. All install/uninstall operations are through winetricks. You can install apps by selecting "Run uninstaller" in winetricks. Not very intuitive, indeed :)
Manual installation with wine does not work. Also, not checked with latest dev wine, just 3.18 and 3.20
Try again with a fresh new wine environment.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Mihai,
Thanks for reply. I have Wine Development version 4.2 installed. Step 11 gave "The .NET Framework 4.5.2 is not supported on this operating system." This is not surprising given that the above Microsoft webpage (for .NET 4.5.2 Redistributable Offline i.e. https://www.microsoft.com/en-us/download/details.aspx?) does not give Windows XP (which you specified in step 6) as a supported OS (but allows Vista, Windows 7, Windows 8). What should I do?
 

johnaaronrose

Active Member
Licensed User
Longtime User
Ok till step 15. Installing JDK from downloaded jdk-8u201-windows-i586.exe (i.e. x86 version) gave 2 Java windows: one with nothing in it and other titled " Java SE Development Kit 8 Update 201 - Progress" with Status bar looking complete after a few seconds, but neither window disappearing. Is that expected behaviour?
 

johnaaronrose

Active Member
Licensed User
Longtime User
Another problem. winetricks package is not in http://dl.winehq.org/wine-builds/ubuntu/dists/bionic/main/binary-i386/ i.e. URL from where I downloaded the 3.18 devel i386 version of wine (as a .deb file).

When I install winetricks from Ubuntu repos, it then brings in 3.0.1 versions of various Wine packages e.g. wine-stable. "wine --version" then shows wine-3.0. I think that this causes a problem when I try to install b4a.exe to run under Wine as running B4A gives an error window as in attached file. Is there a version of winetricks which will not cause the installation of these 3.0.1 wine packages?
 

Attachments

  • B4A Runtime Screenshot from 2019-02-20 17-27-59.png
    B4A Runtime Screenshot from 2019-02-20 17-27-59.png
    13 KB · Views: 452

Mihai Rainer Jr.

Member
Licensed User
Guys, today I have reinstalled B4X suite (B4A 8.50 and B4J 6.51) on my laptop, with the wine stable version 4.0
There are few modifications, check the initial post
 

johnaaronrose

Active Member
Licensed User
Longtime User
Mihai,
I presume that you meant the initial post on this thread. That has not been changed to wine stable version 4.0.
 

johnaaronrose

Active Member
Licensed User
Longtime User
Step 1 states to use Wine 3.18 (1. Install last development version of Wine (3.18) - x86 version_ NOT Wine 4.0 stable i386.

There is still the problem with installing winetricks:
When I install winetricks from Ubuntu repos, it then brings in 3.0.1 versions of various Wine packages e.g. wine-stable. "wine --version" then shows wine-3.0. I think that this causes a problem when I try to install b4a.exe to run under Wine as running B4A gives an error window as in attached file. Is there a version of winetricks which will not cause the installation of these 3.0.1 wine packages?
 
Top