Bug 53187 - AXML: res-auto xmlns doesn't work in library projects
Summary: AXML: res-auto xmlns doesn't work in library projects
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: Designer ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.7
Assignee: Jérémie Laval
URL:
Depends on:
Blocks:
 
Reported: 2017-03-09 12:17 UTC by aspyct
Modified: 2018-01-09 18:22 UTC (History)
7 users (show)

Tags: vs, vsmac
Is this bug a regression?: No
Last known good build:


Attachments
Sample project illustrating the issue (3.24 MB, application/zip)
2017-03-09 12:17 UTC, aspyct
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 53187 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description aspyct 2017-03-09 12:17:24 UTC
Created attachment 20243 [details]
Sample project illustrating the issue

The designer fails to preview a PercentFrameLayout used in an android library project.


Steps to reproduce:
- Open the attached solution. It contains two projects, one of which is an android library (name: "lib"), the other is an android app (name: "testlib").
- Notice the similarity between the "BrokenLayout.axml" and "WorkingLayout.axml"
- Open "BrokenLayout.axml" in the designer.


Actual result:
- The designer doesn't work for the BrokenLayout.axml in the library.


Expected result:
- The designer should work properly, just like it does with "WorkingLayout.axml"


Note:
I was initially opening a ticket because the PercentFrameLayout wasn't working from the library project, because we couldn't use the xmlns:app="http://schemas.android.com/apk/res-auto" in the library.
This seems to have disappeared somehow, for now at least. I seem to have different varying results with the .axml files located in the android library.
Comment 1 Pierce Boggan [MSFT] 2017-06-23 20:02:43 UTC
Thanks for taking the time to file this issue ticket and leave such detailed repro steps and project @aspyct! :)

I'm actually getting a "Something went wrong" when loading up the "WorkingLayout.axml":
Bridge [resources.resolve] Couldn't resolve resource @string/app_name
Creating class loader with 10 projects

Creating LibraryClassLoader in shadow copy path C:\Users\piboggan\AppData\Local\Temp\AndroidDesignerJars3120877467471698710
Trying to load class android.support.percent.PercentFrameLayout

mono.android.DesignerException: java.lang.ClassNotFoundException
	at mono.android.DesignerException.fromThrowable(DesignerException.java:46)
	at mono.android.DesignerSession.checkRenderResultForError(DesignerSession.java:187)
	at mono.android.DesignerSession.load(DesignerSession.java:239)
	at mono.android.DesignerSession.processMessage(DesignerSession.java:702)
	at mono.android.MessageListener.executeMessage(MessageListener.java:88)
	at mono.android.MessageListener$Runner.run(MessageListener.java:44)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: android.support.percent.R$styleable
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at mono.android.LibraryClassLoader.findClass(LibraryClassLoader.java:53)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at android.support.percent.PercentLayoutHelper.getPercentLayoutInfo(PercentLayoutHelper.java:150)
	at android.support.percent.PercentFrameLayout$LayoutParams.<init>(PercentFrameLayout.java:125)
	at android.support.percent.PercentFrameLayout.generateLayoutParams(PercentFrameLayout.java:101)
	at android.support.percent.PercentFrameLayout.generateLayoutParams(PercentFrameLayout.java:79)
	at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:860)
	at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
	at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
	at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368)
	at mono.android.DesignerSession.load(DesignerSession.java:233)
	... 4 more

Marking this as CONFIRMED and moving to VS Extensions.