B4J Tutorial B4LinuxInstall script to use B4X tools in linux

This is a Bash shell script that allows installing B4J and B4A in linux systems, along with their required dependencies. It is very functional. But for now only Ubuntu is fully supported.

The project has a repository in github. The only file you need is b4linuxinstall.sh. You can install it by opening a terminal and entering these commands:

B4X:
wget github.com/joseluis/B4LinuxInstall/raw/master/b4linuxinstall.sh
bash ./b4linuxinstall.sh
To install B4i and B4A you must download the installers and put them in the same directory before executing the script.
---

This is a work in progress. More linux distributions will also be supported eventually. There is a poll in this thread to know which are the most used in the community in order to prioritize them.

I must thank Zolive33 for his previous(1) work(2) from which B4LinuxInstall is built upon and tries to improve on the mission of bringing the software we love to our Linux computers.

UPDATE 2016: Since I'm no longer a user of B4X I'll probably wont be updating this tool anymore. Also it seems that since B4A version 5 there are some compatibility issues that difficults running it in linux.
 
Last edited:

joseluis

Active Member
Licensed User
Longtime User
This is video demonstrates how the script works:
Changes since the version portrayed on the video:
  • To install B4A & B4i in the current version now you have to place the installers in the same directory as the script.
 
Last edited:

doogal

Member
Licensed User
Longtime User
Hey Thanks for the video great work. I don't know whats different on your system than mine, but mine is still looking for aapt.exe. The error says:
B4X:
Cannot find: Z:\home\user\workspace_b4\android-sdk-linux\platform-tools\aapt.exe
Please configure paths (Tools - Configure Paths).

I will try this again tomorrow on another computer.

Again, thanks for all your assistance. The video did help.
 
Last edited:

joseluis

Active Member
Licensed User
Longtime User
Strange... The only thing I can think of right now is that maybe you didn't install the platform tools. And if you did, just try to find the file manually and copy it where it's expected to be. Like this:

B4X:
cd ~/workspace_b4
find aapt.exe
PATH/TO/AAPT.EXE
B4X:
cp PATH/TO/AAPT.exe ~/workspace_b4/android-sdk-linux/platform-tools/
 

doogal

Member
Licensed User
Longtime User
Hey, again thanks for all your assistance. I do not know what is going on here. I have even re-installed the OS, started fresh and still get the same error. I hope you can help me. I am uploading some screenshots of my installation. The first four are of the SDK:
[URL=http://s1289.photobucket.com/user/Douglas_Purcelle/media/Screen1_zpsac10cbfa.png.html] [/URL]
[URL=http://s1289.photobucket.com/user/Douglas_Purcelle/media/screen2_zpsfcc6d422.png.html] [/URL]
[URL=http://s1289.photobucket.com/user/Douglas_Purcelle/media/screen3_zps8b492644.png.html] [/URL]
[URL=http://s1289.photobucket.com/user/Douglas_Purcelle/media/screen4_zpse3a09496.png.html] [/URL]

The next shows that I have an aapt file, but its not an .exe and there's not one on the system anywhere
[URL=http://s1289.photobucket.com/user/Douglas_Purcelle/media/screen5_zpsb8f08e88.png.html] [/URL]

B4X:
dougie@doug-Studio-1737:~$ cd ~/workspace_b4/
dougie@doug-Studio-1737:~/workspace_b4$ find aapt.exe
find: `aapt.exe': No such file or directory

I'm not ready to give up hope yet. I want only one OS on my computer and that is Ubuntu. This is the only program I really use in Windows and I would really like to use it in Linux. I have no other use for Windows than for B4A.

Thank you,
Doug
 

joseluis

Active Member
Licensed User
Longtime User
Ok, try this. You need a different syntax for the find command.
B4X:
find . -name "aapt.exe"

Also please tell me the version of wine you have:
B4X:
wine --version
 

doogal

Member
Licensed User
Longtime User
B4X:
find . -name "aapt.exe"
find: `./.cache/dconf': Permission denied
find: `./.dbus': Permission denied
find: `./.gvfs': Permission denied
dougie@dougie-X202EV:~$ wine --version
wine-1.6.2

and on the other computer

B4X:
dougie@doug-Studio-1737:~$ find . -name "aapt.exe"
dougie@doug-Studio-1737:~$ wine --version
wine-1.6.2
dougie@doug-Studio-1737:~$
 
Last edited:

Fusseldieb

Active Member
Licensed User
Longtime User
@joseluis You are great!!! It have worked just perfectly. Awesome "port" :)

A bit of topic, but I have wanted to know which dependencies would VB.Net 2008-2010 use?
If I could make VB.Net run on my machine, I can finally abandon Windows :D

Thanks in advance ;)

EDIT: I could make adb partially run on wine, by copying the dlls that are necessary and now i'm stuck on this "problem":

B4X:
valentino@valentino-HP:~$ wine '/home/valentino/workspace_b4/android-sdk-linux/android-sdk-linux/platform-tools/adb.exe' devices
List of devices attached

valentino@valentino-HP:~$
My phone is plugged and Ubuntu and ADB recognizes it, but ADB over wine doesn't. I have already installed the windows drivers for my phone...
What this could be?
 
Last edited:

doogal

Member
Licensed User
Longtime User
@Fusseldieb, What did you do to get this to work? I have been trying and still can't get it. I am getting cannot find aapt.exe error.
 

Fusseldieb

Active Member
Licensed User
Longtime User
@Fusseldieb, What did you do to get this to work? I have been trying and still can't get it. I am getting cannot find aapt.exe error.
Just copy the aapt.exe from the windows package into the folder and it works (Don't know how it does work, it just works .-.)
My path to this file is:
B4X:
/home/valentino/workspace_b4/android-sdk-linux/android-sdk-linux/build-tools/21.1.1
Into this folder you copy the content of this where is attached on my post ( I am a great person, aren't I? :p )
And voila ;)

EDIT: The next error you'll get is not finding adb... But don't mind. Just connect over B4A-Bridge, I will try to find a solution for adb... :)
(adb is just necessary to perform a direct install of your apk on your phone.)
 

Attachments

  • ExtractThis.zip
    392.1 KB · Views: 437
Last edited:

doogal

Member
Licensed User
Longtime User
Wow, thank you so much for that Fusseldieb. I was finally able to compile an app in Ubuntu. I did however, have to copy over zipalign.exe as well. Now, I can go from here and work on getting the AVD and B4A bridge working and I'll be all set.

If you know of a fix for these as well as the adb then please let me know.

Again, Thank you so much for your help.
 

joseluis

Active Member
Licensed User
Longtime User
Thanks for helping @Fusseldieb

@doogal I don't know why in your case the windows files were not deployed. The script automatically should download all the needed files for windows compatibility and copy them into the appropriate folders. It does so in my tests anyway.

You can also do it by manually downloading the file from here and copying the contents by hand:
https://github.com/joseluis/B4LinuxInstall/raw/master/sdk-B4A.tar.gz
 

doogal

Member
Licensed User
Longtime User
@joseluis, Thank you so much for that file. That did it. :) I can now send the apk to the device as well. I do not know why the script didn't install these files, but installing them manually wasn't that hard to do.

One more thing, yes I know, but its minor. How can I send the apk through usb instead of over WIFI. Sometimes, I am out and about and don't always have a wifi connection and would really like to use the USB option instead. Do I need to install the USB drivers for my device just like in Windows, and if so, is there a special package for these or are they available from the manufacurer?

I can now get rid of Windows for good. Thank you both for all your hard work on this.
 

Fusseldieb

Active Member
Licensed User
Longtime User
How can I send the apk through usb instead of over WIFI.
That requires adb... I have tried to put adb in that folder, but it doesn't work, because it needs USB support (Wine couldn't handle USB that good)
Ubuntu has a native adb, but b4a can't access it. @Erel should in the next version include in "Configure Paths" a option to specify the file for adb.
 

joseluis

Active Member
Licensed User
Longtime User
That's right, I've never managed to make adb usb connection work with wine, so I always use wifi.
 

Fusseldieb

Active Member
Licensed User
Longtime User
EXCELENT news for everyone who uses Ubuntu!!!

I have figured out how to use adb on B4A. :D

Screenshot from 2014-11-29 23:48:17.png


Just follow these steps:

1. Reboot your PC (Yes, do this first!)
2. Install adb tools. Do this opening the terminal (Ctrl+Alt+T), write following below and press Enter.
B4X:
sudo apt-get install android-tools-adb
3. When installed, connect your phone on your pc. (Be sure to have USB Debugging enabled pn your phone.)
4. When connected, leave the terminal open,write following below and press Enter:
B4X:
adb devices
5. Now copy the contents from the downloaded zip (You find the zip on the end of this post) file in the folderpath below: (Replace "valentino" with your username)
B4X:
/home/valentino/workspace_b4/android-sdk-linux/android-sdk-linux/platform-tools/<copy all files here>
6. Start your B4A and compile your project. ADB will work now (perfectly fine with all its functions)!

Just note, that:
Every time you start ubuntu you must, at least once, open the terminal and write:
B4X:
adb devices
(If you don't want to write this every time, paste it in the autostart of Ubuntu.)
If you don't write this at least once, adb on wine will not recognize your device!
If you have compiled your project without doing that, you will see adb failing to detect your device and then you automatically have messed up with your drivers. In that case, reboot your pc and try again! This time, with the command!!

ZIP File: https://www.sendspace.com/file/iy4i0v

Credits: The (probably) modified ADB version was found by decompil.....nah, it was just opened with the native zip reader on Ubuntu following file: https://goo.im/devs/AdamOutler/JOdin3/
(Oh, that file? This is ODIN for Linux. It's a java file, just download and run with Java installed on your machine.)
 
Last edited:

joseluis

Active Member
Licensed User
Longtime User
Thank you so much @Fusseldieb for your research!

I'll put this adb installation process in the script when I find time for it, probably in january. In the short term I also have plans for making the script more modular, adding a menu to make it easier to use, and supporting debian...

Since I don't have an iphone nor bought b4i I wont be adding it to the script for the time being, maybe next year. I definitely want at some point, but that's more medium-long term.
 

clock

New Member
Thanks for the script @joseluis
The script installs everything smoothly (I didnt install B4J because I just need B4A)


But I am facing an issue running B4A after installation. Clicking its shortcut doesnt seem to do anything.
Running the command:
B4X:
env WINEPREFIX="/home/clock/workspace_b4/wine_b4" wine C:\\windows\\command\\start.exe /Unix /home/clock/workspace_b4/wine_b4/dosdevices/c:/users/Public/Start\ Menu/Programs/Basic4android/Basic4android.lnk
linux shell throws errors
B4X:
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x153e92c,0x153e930): stub...
fixme:exec:SHELL_execute flags ignored: 0x00000100
err:exec:shellex_load_object_and_run failed to get data object

Kindly help



Error FIXED. Apparently .net installation had failed previously. I installed it using winetricks and now everything works greats. Thanks again for the script
 
Last edited:
Top