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: 5
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
 
Top