Other Libraries with internal resources

Discussion in 'Libraries developers questions' started by Erel, Jan 24, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    If you are including resources in your library, packed inside an AAR file then you should use the following package name: anywheresoftware.b4a.objects (it should appear in the embedded AndroidManifest.xml file).

    Each unique package name causes the whole set of resource fields to be duplicated which can lead to the "Too many field references" error during compilation.

    See this post for more information: https://www.b4x.com/android/forum/threads/preferences-material-design-preferences.75482/#post-479172

    Note that you can also apply it to third party libraries if you compile them yourself. You will need to update the "import <package>.R" line.
    corwin42 and DonManfred like this.
  2. DonManfred

    DonManfred Expert Licensed User

    So instead of creating a somepackagename.r.java (if i create a wrap for a lib somepackagename) i should rewrite the thirdparty lib to import a anywheresoftware.b4a.objects.r?

    Honestly i´m not sure about
  3. Erel

    Erel Administrator Staff Member Licensed User

    Yes, it is recommended.
  4. corwin42

    corwin42 Expert Licensed User

    Hey, I was just about to suggest something similar. :)
    DonManfred and Erel like this.
  5. Erel

    Erel Administrator Staff Member Licensed User

    Note that the in next version of B4A the tool chain will support MultiDex configuration so don't spend too much time on this.

    It is still recommended to avoid adding resources by mistake. This will happen if you use Android Studio to build the library. You can delete the AndroidManifest.xml file if you don't need to access your own resources.
  6. DonManfred

    DonManfred Expert Licensed User

    THANK YOU SO MUCH for this info! :D
    I was just trying to adapt my MaterialDrawer (the one from Mike Penz) for this...

    The lib does contain the source from the Material Drawer lib itself but it is referencing some other aar´s used in the drawer. The other aar i do just use (no source) the aar´s.
    Inside eclipse i added the classes.jar from the aar-files to be able to work with Eclipse.

    But this did not really help. I did change the source i was using to anywheresoftware.b4a.objects and it did change the number of subs but not that much that it comes under 64k (there are still some aars with resources used. I just changed the main drawer-source. Not the sources for all of them)

    Seeing this info i´ll stop here, telling the user with the problem to wait a bit and i for myself will joyfully wait for the next great release (as usual). :D
    Erel and stevel05 like this.
  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