I don't know if it is already possible as a search didn't reveal anything but...
wouldn't it make more sense to add manifest blocks and #AdditionalJar declaration inside the class file itself?
Then you (or people using your class) don't need to think about adding the lines to the manifest file and the main activity file.
something in the line of
B4X:
#Region Class Attributes
AdditionalJar: whatever.aar
#End Region
#Region Manifest Attributes
AddPermission (android.permission.ACCESS_NETWORK_STATE)
#End Region
In most cases you don't need to add permissions as they are added automatically based on the source code. You can compile your classes into a library and the library XML file will include all permissions and references to the required libraries.
ok, I had a few days of other things on my mind but I'm back on this topic.
The compile to library is handy for recurring parts of code that you use a lot in similar apps.
This results in a lot less code in the project itself.
The only thing I dislike is the fact that the manifest part is simply ignored.
Maybe your compile to library code should out a libraryname.manifest file that's been added to the project manifest during compilation.
so you get
library.jar
library.xml
library.manifest
or make it part of the xml
Now you still need to think about copying that code from somewhere (forum/other project) to the manifest yourself.
With one of the above solutions it's just part of the library.
thanks, that seems to be what I want despite that you still need to add the createfromresourcefile() line yourself.
what about auto including a default.b4x_excluded if it exists to prevent the manifest tweaking?
I have another question but I'll put it in that other thread.
Maybe in the future. I'm not sure that it is the best idea to let libraries add manifest code automatically. It will be difficult for the developer to control it.
You're right. the import doesn't parse the manifest file so if there is a createresourcefromfile() inthere it won't work and you have to add it to the manifest yourself anyway.
The manifest is a lot cleaner with these createresourcefromfile() lines. thanks for implementing that.