Wish class properties for manifest & additionaljar

Discussion in 'Bugs & wishlist' started by sorex, Aug 7, 2018.

  1. sorex

    sorex Expert Licensed User

    Hello,

    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

    Code:
    #Region Class Attributes
     AdditionalJar: whatever.aar
    #End Region

    #Region Manifest Attributes
     AddPermission (android.permission.ACCESS_NETWORK_STATE)
    #End Region
     
  2. JohnCody

    JohnCody Well-Known Member Licensed User

  3. Erel

    Erel Administrator Staff Member Licensed User

    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.
     
  4. sorex

    sorex Expert Licensed User

    If I choose "Compile to library" is that only for the active source panel?

    Or for everything?

    What happends with the main source code then that is used for testing?
    Is that also added?
     
  5. sorex

    sorex Expert Licensed User

    sorry... I found the 'compile to library' thread and there it explains what it does.

    "When you choose this option all the modules except of the main activity are compiled into a library."


    Is the default manifest like below data skipped?

    Code:
    AddManifestText(
    <uses-sdk android:minSdkVersion=
    "5" android:targetSdkVersion="26"/>
    <supports-screens android:largeScreens=
    "true"
        android:normalScreens=
    "true"
        android:smallScreens=
    "true"
        android:anyDensity=
    "true"/>)
    SetApplicationAttribute(android:icon, 
    "@drawable/icon")
    SetApplicationAttribute(android:
    label"$LABEL$")
     
  6. sorex

    sorex Expert Licensed User

    For some reason I still need to add the manifest lines to my test project aswell or it won't work right.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Of course. The manifest code is not part of the library. You don't want that each library will set your app icon and label.
     
  8. sorex

    sorex Expert Licensed User

    I was talking about the manifest data belonging to my class/library in my previous post.
     
  9. sorex

    sorex Expert Licensed User

    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.
     
  10. Erel

    Erel Administrator Staff Member Licensed User

  11. sorex

    sorex Expert Licensed User

    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.
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    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.
     
    Last edited: Aug 13, 2018
  13. sorex

    sorex Expert Licensed User

    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice