R rosippc64a Active Member Licensed User Longtime User Jun 13, 2016 #101 @Erel I am learning how to make a small lib. I did the video tutprial and I did the firstlib. No problem. Now I go on but I don't know how? I have this code: Code: @ShortName("First") @Events(values={"Event (X As int)"}) @Version(1.01f) public class First { ... protected Sometype createSecondClass() { BA.Log("ThisShown"); return new Second(); } public class Second { ... } } I can make jar and xml file, the b4a can see, and use too the things in First class part. But when I want to use a function (createSecondClass) from First what would like to initialise the Second class, then there is a noClassDefFoundError: First$Second. I have a First$Second.jar also, but I don't know what I have to say and where that b4a do know the Second class? I made two different .java files for the two class, and I compiled to .jar. When I compile the b4a project, the b4a can't access an imported class what there is in the before compiled .jar. B4a can show functions from .jar (because a good .xml), but can't compile. Last edited: Jun 13, 2016
@Erel I am learning how to make a small lib. I did the video tutprial and I did the firstlib. No problem. Now I go on but I don't know how? I have this code: Code: @ShortName("First") @Events(values={"Event (X As int)"}) @Version(1.01f) public class First { ... protected Sometype createSecondClass() { BA.Log("ThisShown"); return new Second(); } public class Second { ... } } I can make jar and xml file, the b4a can see, and use too the things in First class part. But when I want to use a function (createSecondClass) from First what would like to initialise the Second class, then there is a noClassDefFoundError: First$Second. I have a First$Second.jar also, but I don't know what I have to say and where that b4a do know the Second class? I made two different .java files for the two class, and I compiled to .jar. When I compile the b4a project, the b4a can't access an imported class what there is in the before compiled .jar. B4a can show functions from .jar (because a good .xml), but can't compile.
R rosippc64a Active Member Licensed User Longtime User Jun 14, 2016 #102 I have one step ahead. The b4a can see the missing class. The solution was: I copied the lib having the class into b4a library folder. After it that was ok, but I didn't was satisfied that I don't know the real reason and I remove the lib from the folder, and remove a sign from eclipse's properties, where the ioiolib was checked and the result: b4a can't see the class again. How I can embed the neccessary lib into the jar that b4a can see? Last edited: Jun 14, 2016
I have one step ahead. The b4a can see the missing class. The solution was: I copied the lib having the class into b4a library folder. After it that was ok, but I didn't was satisfied that I don't know the real reason and I remove the lib from the folder, and remove a sign from eclipse's properties, where the ioiolib was checked and the result: b4a can't see the class again. How I can embed the neccessary lib into the jar that b4a can see?
DonManfred Expert Licensed User Longtime User Jun 14, 2016 #103 you need to reference the ioiolib with depends-on directive inside wrapper and copy the jar to your additional libs folder.
you need to reference the ioiolib with depends-on directive inside wrapper and copy the jar to your additional libs folder.
R rosippc64a Active Member Licensed User Longtime User Jun 14, 2016 #104 Thank you DonManfred, I did it. Works. After export I got a small size Firstlib.jar and I copied the ioiolib into the B4a additional library folder. Can I reference this lib such a mode that the ioiolib be packaged into Firstlib.jar? Last edited: Jun 15, 2016
Thank you DonManfred, I did it. Works. After export I got a small size Firstlib.jar and I copied the ioiolib into the B4a additional library folder. Can I reference this lib such a mode that the ioiolib be packaged into Firstlib.jar?
Alberto Iglesias Well-Known Member Licensed User Longtime User Jun 16, 2016 #105 Erel, If I have a jar with dependency of "VALUES.XML", where in a library structure can i put this file to the correct compiling? Thanks Alberto
Erel, If I have a jar with dependency of "VALUES.XML", where in a library structure can i put this file to the correct compiling? Thanks Alberto
DonManfred Expert Licensed User Longtime User Jun 16, 2016 #106 Alberto Iglesias said: f I have a jar with dependency of "VALUES.XML" Click to expand... do you have a jar or a aar? If you have an aar: Like i already told: extract the classes.jar from the aar and add it in eclipse to your buildpaths.use the aar filename in depends-on and copy the aar to additional libs folder. If you have only a jar then you need to create a R.class in your wrapper like in b4a 5 Maybe you should upload your source (src, jar, aar) so we can see.... Or better: Create a new thread for your problem showing enough details/code to check...
Alberto Iglesias said: f I have a jar with dependency of "VALUES.XML" Click to expand... do you have a jar or a aar? If you have an aar: Like i already told: extract the classes.jar from the aar and add it in eclipse to your buildpaths.use the aar filename in depends-on and copy the aar to additional libs folder. If you have only a jar then you need to create a R.class in your wrapper like in b4a 5 Maybe you should upload your source (src, jar, aar) so we can see.... Or better: Create a new thread for your problem showing enough details/code to check...
Alberto Iglesias Well-Known Member Licensed User Longtime User Jun 16, 2016 #107 No... its a JAR, I extract for AAR this jar and one file "values.xml" because I still using B4A 5.80. I starting creating a new library but this jar needs read this xml some variables and I try to create /res/values in my library project But not working
No... its a JAR, I extract for AAR this jar and one file "values.xml" because I still using B4A 5.80. I starting creating a new library but this jar needs read this xml some variables and I try to create /res/values in my library project But not working
DonManfred Expert Licensed User Longtime User Jun 16, 2016 #108 Alberto Iglesias said: I try to create /res/values in my library project But not working Click to expand... DonManfred said: If you have only a jar then you need to create a R.class in your wrapper like in b4a 5 Click to expand... See this too https://www.b4x.com/android/forum/t...sy-3rd-party-library-with-java-part-ii.65156/ Edit: this too (part I of the tutorial) https://www.b4x.com/android/forum/t...l-and-easy-3rd-party-library-with-java.51556/ It shows the way to create the r.java Last edited: Jun 16, 2016
Alberto Iglesias said: I try to create /res/values in my library project But not working Click to expand... DonManfred said: If you have only a jar then you need to create a R.class in your wrapper like in b4a 5 Click to expand... See this too https://www.b4x.com/android/forum/t...sy-3rd-party-library-with-java-part-ii.65156/ Edit: this too (part I of the tutorial) https://www.b4x.com/android/forum/t...l-and-easy-3rd-party-library-with-java.51556/ It shows the way to create the r.java
Alberto Iglesias Well-Known Member Licensed User Longtime User Jun 16, 2016 #109 Great Manfred, I will try to follow your steps.... Thanks
JohnC Expert Licensed User Longtime User Oct 15, 2016 #110 Before I dive into creating my first library, should I install and use Eclipse which this tutorial is based on, or should I use Android Studio instead? And if I should use Android Studio, how different/difficult will it be to do the tutorial for it?
Before I dive into creating my first library, should I install and use Eclipse which this tutorial is based on, or should I use Android Studio instead? And if I should use Android Studio, how different/difficult will it be to do the tutorial for it?
DonManfred Expert Licensed User Longtime User Oct 15, 2016 #111 For me it does not work to use Android Studio. I still use Eclipse for library wrappings.
xiaoyao Active Member Licensed User Longtime User Apr 7, 2025 #113 maybe b4a/b4j.exe can call by java.exe -jar getjarINFO.jar abc.jar? get all public class/function return type,sub,The name and data type of each parameter? about:Basic4android has a very good support for external libraries. In fact almost all of the internal keywords are loaded from an external library (Core library). In order to develop a library you need to have Eclipse installed. The Android plug-in is not required as the libraries are regular Java libraries. The IDE is a .Net process. It cannot load or inspect jar files. Therefore together with each jar file there is an XML file that describes the file to the IDE. This file also holds the documentation for the online help.
maybe b4a/b4j.exe can call by java.exe -jar getjarINFO.jar abc.jar? get all public class/function return type,sub,The name and data type of each parameter? about:Basic4android has a very good support for external libraries. In fact almost all of the internal keywords are loaded from an external library (Core library). In order to develop a library you need to have Eclipse installed. The Android plug-in is not required as the libraries are regular Java libraries. The IDE is a .Net process. It cannot load or inspect jar files. Therefore together with each jar file there is an XML file that describes the file to the IDE. This file also holds the documentation for the online help.