Android Question java.lang.IllegalArgumentException: already added

Star-Dust

Expert
Licensed User
Longtime User
I have compiled a library and when I recall it in my app it signals me this error.

Uncaught translation error: java.lang.IllegalArgumentException: already added: Lb4a/example/designerscripts/LS_layout1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lb4a/example/designerscripts/LS_layout2;
2 errors; aborting

While if I use it as a source it compiles me correctly. Opening the Jar file I find (in DesignScript folder) two files LS_Layout1.class and LS_Layout2.class inside.

The thing seems strange to me, and I am proposing these files that make me the error.
I have physically deleted these two files from the jar file and now compiles correctly.

why do you create these files for me? how do you solve this problem?

Update:
This morning I recompiled the library does not create the folder DesignScript . Yesterday, instead, this folder containing these 2 Class created :confused:
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
It seems that somehow the two layouts I had created gave rise to the two classes in the compilation.

Classes that were in conflict with the classes created by the Layouts of the App that used the library.

However today correctly, when I compiled as a library, layouts are ignored and classes are not generated.

This thing is not the first time that happens to me, that by compiling as a library, I am generated with layout-related classes.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The problem is back, I compile a library and I find a class for each layout existing in the project.

To avoid problems I have to open the Jar file and delete these classes.

But is it a BUGS?
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
It does sound like a bug. Does it happen if you clean the project before compiling it as a library?
No, cleaning up the project does not show these classes.
It seems that they appear after I have compiled as an APK and later as a library.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Fixed for the next version. BTW, why aren't you creating b4xlibs? They should be the default format.
I answered this question another time. Some libraries want to keep the source code confidential. But at least half of my libraries are made in B4Xlib format.

I also hope that one day you will add the function that automatically creates the manifest and the compressed file B4XLIb. :p
 
Upvote 0
Top