Share My Creation [B4X] [Project Template] B4X Library

version: 1.01

This project template can be use for starting a B4X class library project.
The project also contains a Demo folder which contains B4XPages projects and a Server project that already linked to the library's class using relative path.

GitHub: https://github.com/pyhoon/B4X-Library-Template

Project structure


* I learned that the project generated from template is following alphabetical order. It means if use "Test" folder instead of "Demo", once the new project is created, it will open the project inside "Server" folder. I don't want this to happen, so I renamed it to "Demo". Then the project will be loaded from "Lib" folder. This is the actual project we expect to work with.
* Another thing is $APPNAME$ works with this unusual project structure. The project created using this template will named according to the name that the developer entered when create a new project from menu File -> New -> B4X Library.

How to use:
  1. Download attached B4X Library.b4xtemplate and drop it to Additional Libraries/B4J
  2. Create a project from B4J from menu File -> New -> B4X Library.
  3. The project in "Lib" folder will be opened.
  4. Develop your library.
  5. Once you are happy with it, test whether it also works for B4XPages UI (B4A, B4i, B4J) and Server projects inside the "Demo" folder.
  6. Change the LICENSE file if you like.
  7. Use #Macro: Title, Update Version with manifest-writer.jar to write the manifest.txt file.
  8. Use #Macro: Title, Create B4xLib to package your library. The YourLib.b4xlib will be created inside your project folder.
  9. Use #Macro: Title, Copy to B4X AddLibs to copy the library to the Additional Libraries/B4X folder.
  10. Share your library with the community.
 

Attachments

  • B4X Library.b4xtemplate
    10.4 KB · Views: 47
Last edited:

aeric

Expert
Licensed User
Longtime User
The GitHub project source code is a B4J project that creates a B4J project template that create a B4X library project that can be tested by itself and/or using any of the 4 projects inside the "Demo" folder. It means there are 6 projects inside the source.

Inside /source/Lib folder:
Lib.b4j -> will create the template using #Macro
$APPNAME$.b4j -> will be included inside the template.
 
Last edited:

aeric

Expert
Licensed User
Longtime User
version 1.01
Fixed error creating <YourLib>.b4xlib
The b4xlib is now created inside your project folder.

Steps:
  1. #Macro: Title, Update Version (Ctrl + 1) <-- write manifest.txt
  2. #Macro: Title, Create B4xLib (Ctrl + 2) <-- package your b4xlib
  3. #Macro: Title, Project Folder (Ctrl + 3) <-- check the file, ready to distribute
  4. #Macro: Title, Copy to B4X AddLibs (Ctrl + 4) <-- ready to use for your other projects
 

aeric

Expert
Licensed User
Longtime User
Thanks hey, my head is thinking that there is a template to create b4xlibs for b4a... read the manual, got some light.
I am not clear about your question. What do you want to achieve?
 

aeric

Expert
Licensed User
Longtime User
I thought there is a b4xtemplate to create a b4xlib for b4a. So I read the help manual you gave me and got a way on how to do it. I just need to zip the files.
I think you just need to understand what is a b4xlib. You can open Erel's b4xlib like XUI Views to see what it is.
 

aeric

Expert
Licensed User
Longtime User
The project template I shared in first post is more for general purpose b4xlib which doesn't depend on UI library.
I created a lot of such libraries so I just created a template to package these type of libraries more conveniently.

Examples of these libraries are MiniORMUtils, MiniHtml, MiniCSS, MinimaList, etc.
These libraries should work for B4A, B4i, B4J and non-UI apps.
 
Top