Bug? AndroidManifest package name conflicts

Spavlyuk

Active Member
Licensed User
In the past it has been suggested that libraries with resources use anywheresoftware.b4a.objects as the package name. However, since v10.7 if more than one library uses this package name, their resources may not be imported.

I tested the following with a custom library. It works fine on its own with the suggested package name, but if used with another library such as AppCompat, a missing resource error is thrown. In fact, the resources of my library were not added at all to the resulting apk file. However, using a unique package name resolves the issue.

I believe this is also why DesignSupport is not working now, even though it was working fine with v10.6. It depends on AppCompat, which uses the the same package name. The fix would be rather trivial if the author still has the source code.

Is this new behavior intended or is it something that can be fixed?
 

Spavlyuk

Active Member
Licensed User
Upon further testing, it seems that only the resources of the first loaded library are kept, based on the order they are in the .b4a file.
 

Attachments

  • SP_Resources.noconflict.zip
    33.6 KB · Views: 143
  • SP_Resources.zip
    35 KB · Views: 137
  • resourcestest.b4a.zip
    3.8 KB · Views: 146

Spavlyuk

Active Member
Licensed User
Not exactly, the library needs to be recompiled with a unique namespace.

Also, I'm not sure what you mean. "Objects\gen\anywheresoftware\b4a\objects\R.java" does not contain the resource from the test library and neither does the resulting apk actually contain the resource.
 

Spavlyuk

Active Member
Licensed User
I had tested that before posting and it wasn't working. Though after double checking, it seems to be working just by modifying the manifest file.

The behavior does seem somewhat inconsistent though. Changing the manifest of DesignSupport doesn't seem to affect it but if I manually change the order of the libraries in the .b4a file, it runs without issue. Maybe I'm running into a cache issue.

Anyway, I'm assuming libraries should use their own namespace from now on?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I had tested that before posting and it wasn't working. Though after double checking, it seems to be working just by modifying the manifest file.
Testing it can be confusing. You must clean the project (Ctrl + P) after you make this change. Otherwise it will reuse the previous resources.

Anyway, I'm assuming libraries should use their own namespace from now on?
Yes. I will update that thread.
 
Top