Android Tutorial [java] Video tutorial - Creating a simple library

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is a new tool available for compiling libraries. It is much simpler: http://www.b4x.com/forum/showthread.php?p=173756


I've uploaded a video tutorial to YouTube which explains the steps required for building a library with Eclipse: Basic4android Tutorial - Creating a library - YouTube

The doclet tool and more information are available here: http://www.b4x.com/forum/libraries-developers-questions/6810-creating-libraries-basic4android.html

One step is missing from the video by mistake. Exporting the project as Jar file from eclipse.
It is done by right clicking on the project - Export:

SS-2011-11-06_17.46.00.png


You should then choose jar and the default options should be good.
 

NJDude

Expert
Licensed User
Longtime User
Very nice!.

If I may, first, try to get the sound a little louder and maybe normalizing it to keep the same volume level and second, using this example, a more detailed explanation about what you're doing, I know is a simple multiply function but it would be helpful to know what are you doing, that would help beginners to get a better grasp.

Video tutorials are always good even if they are simple as this one.

Very good, thanks.
 

stevel05

Expert
Licensed User
Longtime User
Very good Erel, great initiative. I think it's great that you encourage this open approach. I can see a surge in new libraries from users.
 

Asmoro

Active Member
Licensed User
Longtime User
Hi Erel,

Cool to have video tuts, another big reason to stick and enjoy with your program.
And a big boost for beginners as well like me.

Hopefully more will come in the future as a standard.

grtz.
Asmoro
 

Gigatron

Member
Licensed User
Longtime User
Thank you Erel

This is very very easy than how to create library article.

Waiting the next video ... :)
 

tremara1

Active Member
Licensed User
Longtime User
LIBerated

I have not programmed in java but I watched the video and thought I would get eclipse and give it a crack. I dont think any of you have any reason to fear I might become expert but I was able to get a silly "hello world" lib up and running first go. I dont know what I can apply it to but at least I am beginning to understand what is behind all the great stuff you guys put out there for us. Thanks.
 

bparent

Member
Licensed User
Longtime User
Excellent video and easy to understand and follow.

How about doing a video on how to wrap java code and use from B4A?
 

StevieC

Member
Licensed User
Longtime User
Hi Erel,
I've followed the video. The FirstLib.xml is written but not the .jar.

This is the console output........


Loading source files for package anywheresoftware.b4a.sample...
Constructing Javadoc information...
[-doclet, BADoclet]
[-docletpath, C:\Users\Steve\Downloads\BADoclet]
[-sourcepath, C:\Users\Steve\workspace\FirstLib\src]
[-classpath, C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries\Core.jar;C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries\B4AShared.jar;C:\Android\android-sdk\platforms\android-8\android.jar]
[-public]
[-b4atarget, C:\Users\Steve\Downloads\FirstLib.xml]
starting....
Working with class: anywheresoftware.b4a.sample.FirstLib
finish: C:\Users\Steve\Downloads\FirstLib.xml
warning: no version field.


Any ideas?
 
Last edited:

StevieC

Member
Licensed User
Longtime User
Thanks Erel. Sorry I had missed that.

I've taken some java code and created a library. When I try and use it in Basic4Android I get the error message:

An Error Occured
Error Parsing Libraries
src.javazoom.jl.player.PlayerApplet.size already exists.


Any idea as to how to go about solving that?
 

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Make Libs

I just tried to make a lib, following step by step the tutorial. The final step didn't produce the xml and jar file. Actually it doesn't produce anything. The only "variant" with respect to the video example is that I downloaded the BADocLet in a folder and, instead of giving same folder as target folder for xml file, I gave another (that was of course created before). (Before sending this post, anyway, I tried with same folder, and same result). DocLet folder was copy/pasted as in video, and same for xml target folder. Unluckily I come from VisualStudio C++ programming and I am new to Eclipse and Java. I attach a zip file containing all the screen-shots. I don't figure out where is the problem and I fear it could be an obscure Eclipse, java or android installation issue..
(note: in my folder strings "Programmi" is the equivalent of "Program Files")
 

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Make Lib

About my previous post:
I saw that I was missing Export option, described in Erel's post (I went to video before reading all..). So this created the jar. But the xml is still not created..
 

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Make lib

Answering to my question. It seems that the reason is that I wrote DocLet and not Doclet in the Doclet class path... Now the xml appeared. Now I confirm that everything is ok.
 
Top