As B4X matures, more and more reusable components are written in B4X directly.
In most cases it is simpler to implement the logic in B4X directly and the code can be cross platform. Especially with the relatively new XUI library.
Standard libraries will never be cross platform as they are compiled to the platform native binary / bytecode. They also have other restrictions related to them being compiled.
Starting with B4A (8.80), B4i (v5.50) and B4J (v7.00), a new type of libraries is available - b4x libraries.
A b4x library is a simple zip file with:
- Code modules. All types are supported including activities and services.
- Files, including layout files.
- Optional manifest file with the following fields:
Version, DependsOn (list of required libraries), Supported Platforms. Fields can be shared between the platforms or be platform specific. For example:
Version=2.00
B4J.DependsOn=jXUI, jDateUtils
B4A.DependsOn=XUI, DateUtils
B4i.DependsOn=iXUI, iDateUtils
Files and code modules can also be platform specific.
Creating a b4x library is very simple. You just need to create a zip file with these resources. The zip file extension should be b4xlib. That's all.
Note that the source code can be extracted from a b4x library.
b4x libraries appear like all other libraries in the Libraries tab.
Example of AnotherDatePicker custom view packaged as a b4x library is attached. It is cross platform and using it is a matter of clicking on the library in the list of libraries.