Java Question Building a Jar that contains android-support-annotations

Johan Schoeman

Expert
Licensed User
A little bit lost here. I am using B4A to build a Jar with the below code:

B4X:
#AdditionalJar: com.android.support:support-v4
#AdditionalJar: com.android.support:support-compat
#AdditionalJar: com.android.support:support-annotations

But the final jar (stan.jar built by the B4A project) does not include "android-support-annotations". Unless I add the attached "android-support-annotations.jar" to the libs folder of my library project it will not compile with SLC. If I add the attached Jar then it compiles without a problem.

What am I missing when building stan.jar?

Rgds

JS
 

Attachments

  • android-support-annotations.jar
    19.5 KB · Views: 231

DonManfred

Expert
Licensed User
If I add the attached Jar then it compiles without a problem.
it is expected that you put this jar into libs folder.

What is the problem/question?
 

Johan Schoeman

Expert
Licensed User
it is expected that you put this jar into libs folder.

What is the problem/wuestion?
Creating stan.jar after compiling the B4A code/project does not include support-annotations in the stan.jar file. I need to add an old android-support-annotations jar to the libs folder of the project else SLC generates an error while compiling.

android-support-v4 and android-support-compat are included in stan.jar but not support-annotations....
 

Johan Schoeman

Expert
Licensed User
I usually add the attached to my libs folder. And so far it does work.
As witten above it is expected that you put this jar into libs folder. But if you do everything should work.
I am trying to understand when creating stan.jar is OK with....

B4X:
#AdditionalJar: com.android.support:support-v4
#AdditionalJar: com.android.support:support-compat

.....but ignores....
B4X:
#AdditionalJar: com.android.support:support-annotations

....when creating stan.jar. I juts want stan.jar in the libs folder and not have to add support-annotations-xxxxx.jar to the libs folder. Is that possible?
 

Johan Schoeman

Expert
Licensed User
As far i understand: NO. Just put them into libs folder. You only need it when compiling. It will never be included in the generated JAR.
Still dont understand. I just want to create stan.jar and it should include anootations as what it does with the other two references added with "additionaljar"

So, only have stan.jar in the libs folder and nothing else. Stand.jar must include all 3 references to
Support-v4
Support-compat
Support-annotations.

The first 2 are there (in Stan.jar). Why does annotations get ignored?
 

DonManfred

Expert
Licensed User
I cant answer this sorry. Annotations are used inside the google sources. The annotations jar must be present when compinling. It is not needed ato included as the annotations are just used when compiling the jar.

I never was in the need that the annotations must be included in my wraps or so.
 

Johan Schoeman

Expert
Licensed User
I cant answer this sorry. Annotations are used inside the google sources. The annotations jar must be present when compinling. It is not needed ato included as the annotations are just used when compiling the jar.

I never was in the need that the annotations must be included in my wraps or so.
Could it be because (it seems as if) annotations don't have a .aar file in any of the sub folders of support-annotations?
 

Johan Schoeman

Expert
Licensed User
Why the annotations needs an AAR?
I don't know....just an observation. Why is annotations not included in stan.jar when adding...
#AdditionalJar: com.android.support:support-annotations

...to the B4A project to create stan.jar? I am just trying to understand the reasoning behind it.
 
Top