B4A Library [Tool] Simple Library Compiler - Build libraries without Eclipse

Not open for further replies.
The purpose of Simple Library Compiler (SLC) is to make it easier to build libraries. SLC is responsible for taking the Java source code files and generating the Jar and XML files.

As I see it, it can be useful in two cases:
- Creating wrappers for 3rd party SDKs.
- Modifying and extending existing open source libraries.

Do note that you still need to provide the source code. This tool only helps with the building steps.


How to use

Using SLC is quite simple. The main project folder should include a folder named src and optionally a folder named libs.
The Java source code files should be under the 'src' folder. Java files are saved based on the package name. So if the package is com.example then the structure will be:


Under 'libs' folder you can put any additional libraries that should be referenced during compilation.
The 'bin' folder will be created during the build.

When you press on the Compile button the code will be compiled and the Jar file and XML files will be outputted to the "additional libraries folder" that is set in Basic4android configuration.

Wrapper example

The attached zip file includes a very simpler wrapper that wraps Flurry Analytics library.

The source code:


In order to compile it (and use it) you should download their SDK and copy FlurryAgent.jar to the project 'libs' folder and to the 'additional libraries folder'.


- A simple example is included in the package (FirstLib). It is recommended to start with it.
- You can use a text editor such as Notepad++ to write the Java code.
- Tutorials about libraries development are available in this forum: http://www.b4x.com/android/forum/forums/libraries-developers-questions.32/
- There is no installer. You should just unzip the package and run the program.
- If you need to include any additional files, such as .so files, in the jar then you can create a folder named 'additional'. Any file or folder inside this folder will be added to the jar file.
- Command line mode - You can also run this tool from the command line. It expects two arguments: library name and project path.

- B4J_SimpleLibraryCompiler is included in the zip file. It creates B4J libraries.
- In order to write the library code with Eclipse you need to reference Java 7 and also reference jfxrt.jar:


V1.12 (B4A) - source and target raised to Java 8.
V1.11 - SLC tools compiled with .Net Framework 4.
V1.10 - Adds support for the new structure of Additional libraries folder.
March 2018 - New zip with doclet v1.07.
V1.06 - Fixes the missing "bin\classes" issue.
V1.05 - Fixes an issue with old compiled class files not being deleted.
V1.03 - Fixes an issue related to B4A v5.
V1.02 - Allows usages of Java 7 features.
V1.01 - Fixes an issue with ignore field.

Download link: www.b4x.com/android/files/SimpleLibraryCompiler.zip

You should use Java 8 with SLC (at least when generating the XML).
Last edited:


Licensed User
Longtime User
This will be incredibly useful even with eclipse.
Probably write all the code in eclipse (intellisense) and solve all the warnings. Then use this tool to compile and copy everything. And I guess if you are feeling particularly lucky, write the code in Notepad++ (not me).
Thanks :sign0098:


Active Member
Licensed User
Longtime User
Thanks Erel!
I've configured it as an external tool in eclipse. It works great. :sign0098:


Well-Known Member
Licensed User
Longtime User
Erel, any chance we can get a command line version of this tool? Or does the tool support command line arguments? I would love to be able to just run a batch file to compile my library each time.
Last edited:


Well-Known Member
Licensed User
Longtime User
Hi Erel,
This feather will be a part of B4A ,Yes or No? If Yes,I'll be very happy :),Thank a lot.
Last edited:


Well-Known Member
Licensed User
Longtime User

Thank you so much for this tool. It will make life so much easier.

I have tried the GUI and command line and it does "compile" my wrapper library.

But what is missing are my ".so" files.

I though by including these under the \libs folder they would be picked up and added to the JAR file but they aren't. I also tried putting them under \lib with no luck.

Any chance this feature can be included in the next version?

The reason this is important to me is that (as I've mentioned before) I have a library wrapper which I cant actually distribute since it is against the license agreement. If B4A users can obtain the JAR & .so files themselves and then use your wonderful compiler then I could distribute it that way.

Thanks in advance.



Well-Known Member
Licensed User
Longtime User
Thanks Erel

Ive added the following to my compile batch file using 7-zip;

"D:\program files\7-zip\7z" a D:\Basic4android\AdditionalLibraries\myLib.jar E:\Share\myLib\lib

This adds the .so files (Ive not tested on a device yet but it seems to be correctly located in the JAR.

If you could add this as an option to a future version I would be very happy.



Well-Known Member
Licensed User
Longtime User

Ive just noticed a problem with the SLC. It could be something I've done but let me explain.

I'm using the command line like this;

LibraryCompiler.exe Blah2 E:\Share\AGSforAndroidProxy

The command is successful and the JAR gets created but one of my declarations in B4A is not recognized;

Dim gl As GraphicsLayer

Now looking at the output from the tool I see these lines;

[-b4aignore, E:\Share\AGSforAndroidProxy\src\com\tchart\ags\proxy\android\map\GraphicsLayerWrapper.java]
Ignoring: [E:\Share\AGSforAndroidProxy\src\com\tchart\ags\proxy\android\map\GraphicsLayerWrapper.java]

I know if I run the SLC in GUI mode there is an ignore option but it is not set anywhere in my command line. The GUI (which appears to remember the settings) is also blank.

The thing is that the declaration that fails is in the source being ignored which also happens to be the first source file the program encounters.

UPDATE: I have found that if I actually put something in the GUI (eg com.moo) then the missing source is included. So seems like a bug if the value is set to blank/nothing. Is there an option to set this with the command line operation?

Last edited:
Not open for further replies.