Android Question Problem with Simple Library Compiler

pas

Member
Licensed User
Longtime User
Hello,
This is my first time attempting to create an SDK wrapper for B4A.
The Simple Library Compiler (v1.10) looks like the perfect solution but from what I can tell it is not working for me.
I simply unzip it and attempt to build the FirstLib sample.
No errors are shown during the compile step but I am not able to include FirstLib in a B4A project without getting this error:

Error description: Unknown type: firstlib
Are you missing a library reference?

The firstlib library is included and I have performed the refresh operation.

I think the issue may be in the generated XML file, it looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<doclet-version-NOT-library-version>1.07</doclet-version-NOT-library-version>
</root>

Should it have the xml definition for the class and method?

Thank you for any help.
 

DonManfred

Expert
Licensed User
Longtime User
No errors are shown during the compile step
Post the output of the compilation window in SLC

It looks like this when i compile the FirstLibrary

Starting step: Compiling Java code.
javac 11.0.1

Completed successfully.
Starting step: Creating jar file.
Completed successfully.
Starting step: Creating XML file.
Loading source file E:\Basic4android\SimpleLibraryCompiler\FirstLibrary\src\com\example\FirstLib.java...
Loading source files for package com.auth0...
Constructing Javadoc information...
[-doclet, BADoclet]
[-docletpath, E:\Basic4android\SimpleLibraryCompiler]
[-doclet, BADoclet]
[-docletpath, E:\Basic4android\SimpleLibraryCompiler]
[-bootclasspath, E:\Android.readytorunsdk\platforms\android-28\android.jar]
[-classpath, E:\Basic4android\B4A.exe\../libraries\B4AShared.jar;E:\Basic4android\B4A.exe\../libraries\Core.jar;]
[-sourcepath, src]
[-b4atarget, E:\B4X.Additionallibs\B4A\FirstLibrary.xml]
[-b4aignore, com.water,com.firebase,com.github,com.google,com.auth0,net.tpky,com.firebase,org.json,]
Ignoring: [com.water, com.firebase, com.github, com.google, com.auth0, net.tpky, com.firebase, org.json]
starting....
Working with class: com.example.FirstLib
finish: E:\B4X.Additionallibs\B4A\FirstLibrary.xml
2 warnings

Completed successfully.
*** Don't forget to refresh the libraries list in the IDE (right click and choose Refresh) ***

The XML generated is:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<doclet-version-NOT-library-version>1.07</doclet-version-NOT-library-version>
<class>
<name>com.example.FirstLib</name>
<shortname>FirstLib</shortname>
<owner>process</owner>
<method>
<name>add</name>
<comment></comment>
<returntype>int</returntype>
<parameter>
<name>x</name>
<type>int</type>
</parameter>
<parameter>
<name>y</name>
<type>int</type>
</parameter>
</method>
</class>
<version>1.0</version>
</root>
 
Last edited:
Upvote 0

pas

Member
Licensed User
Longtime User
Thank you Don.
There are definitely differences between your output and mine, this line in your output jumps out: Working with class: com.example.FirstLib
If you have any ideas it would be greatly appreciated.

B4X:
Starting step: Compiling Java code.
Completed successfully.
Starting step: Creating jar file.
Completed successfully.
Starting step: Creating XML file.
Loading source file C:\tmp\SimpleLibraryCompiler\FirstLibrary\src\com\example\FirstLib.java...
Constructing Javadoc information...
[-doclet, BADoclet]
[-docletpath, C:\tmp\SimpleLibraryCompiler]
[-doclet, BADoclet]
[-docletpath, C:\tmp\SimpleLibraryCompiler]
[-bootclasspath, C:\Users\PaulSerotta\AppData\Local\Android\Sdk\platforms\android-28\android.jar]
[-classpath, C:\Program Files (x86)\Anywhere Software\Basic4android\B4A.exe\../libraries\B4AShared.jar;C:\Program Files (x86)\Anywhere Software\Basic4android\B4A.exe\../libraries\Core.jar;]
[-sourcepath, src]
[-b4atarget, C:\tmp\libs\FirstLib.xml]
[-b4aignore, org,com.android,com.example,com.hoho]
Ignoring: [org, com.android, com.example, com.hoho]
starting....
finish: C:\tmp\libs\FirstLib.xml

Completed successfully.
*** Don't forget to refresh the libraries list in the IDE (right click and choose Refresh) ***
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
An error seems to have crept into the example zip over the years. The xml file is empty because the default setting for -b4aignore includes 'com.example' and as you are compiling a 'com.example' class it is ignored. If will work if you remove 'com.example' from -b4aignore.
 
Upvote 0

pas

Member
Licensed User
Longtime User
Thank you so much that fixed the problem! Perhaps the sample can be corrected at some point so others don't hit it too.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
An error seems to have crept into the example zip over the years. The xml file is empty because the default setting for -b4aignore includes 'com.example' and as you are compiling a 'com.example' class it is ignored. If will work if you remove 'com.example' from -b4aignore.
Fixed.
 
Upvote 0
Top