Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UsesXml annotation #1245

Open
ColinTree opened this issue Jun 4, 2018 · 6 comments · May be fixed by #3292
Open

Add UsesXml annotation #1245

ColinTree opened this issue Jun 4, 2018 · 6 comments · May be fixed by #3292

Comments

@ColinTree
Copy link
Contributor

This may be required to create custom Resources like listview item layout.

@ewpatton
Copy link
Member

ewpatton commented Jun 4, 2018

I can see how this would be useful for extensions, but for customizing the appearance of built-in components I would prefer that we have a proper editor for letting users manage the layout of items.

@moliata
Copy link
Contributor

moliata commented Jun 4, 2018

UsesXml should also allow to add custom XML code into AndroidManifest like Compiler.java does.

@ewpatton
Copy link
Member

Rather than introduce a @UsesXml annotation with overloaded semantics, I would suggest instead that we update the extension mechanism and compiler to allow for the inclusion of an AndroidManifest.xml and res/... directory structure similar to how Android Archive (.aar) files work. Then, we can have aapt handle merging these along with any .aar files and the application's AndroidManifest.xml similar to how the gradle build system works.

@SusanRatiLane You should familiarize yourself with Compiler.java before starting this project.

@SusanRatiLane SusanRatiLane self-assigned this Sep 14, 2018
@shreyashsaitwal
Copy link
Contributor

Hi @SusanRatiLane,
Are you still working on this?

@ewpatton
Copy link
Member

This is going to be fixed by #3292

@patryk84a
Copy link
Contributor

patryk84a commented Dec 22, 2024

directory structure similar to how Android Archive (.aar) files work

Yes, I think we need to use a technique similar to adding aar libraries here. Because we need to add an R.txt file and a package for a given library that requires an R.class file. I think the R.txt file must contain predefined identifiers like built-in libraries do. But without it aapt2 also indexes resources correctly. I wonder if we should just create the same R.class file that is created in the main application package, in the library package for which we are adding resources.

On the other hand, there is a PR that adds functionality to add resources from an AAR library without additional annotation, but it is outdated now. But we also have to consider that sometimes we need to create a custom xml file that is not associated with any library.

Maybe we just need to combine the two techniques.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment