Bug 18798 - Root element within .axml is not "fixed up"/replaced with ACW name.
Summary: Root element within .axml is not "fixed up"/replaced with ACW name.
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.12.0
Hardware: PC Windows
: High normal
Target Milestone: 4.16.0
Assignee: Jonathan Pryor
Depends on:
Reported: 2014-04-03 10:58 UTC by Gareth Taft
Modified: 2014-08-07 16:22 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Scratch.CustomRootView.zip (12.18 KB, application/zip)
2014-04-03 12:16 UTC, Jonathan Pryor

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Gareth Taft 2014-04-03 10:58:43 UTC
My layout originally had a ScrollView as the root element defined in the axml file. I needed to make alterations to it's behaviour so created a new class that inherited from ScrollView called CusotmScrollView. I then replaced the ScrollView with a fully qualified reference to the CustomScrollView in the axml file i.e:

<path.to.my.CustomScrollView xmlns:android="http://schemas.android.com/apk/res/android"



This resulted in a runtime error when the view was inflated with Java.Lang.ClassNotFoundException for the CustomScrollView.

My workaround was to add a FrameLayout as the root of the view wrapping my custom view:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  <path.to.my.CustomScrollView xmlns:android="http://schemas.android.com/apk/res/android"



This removed the error.
Comment 1 Jonathan Pryor 2014-04-03 12:16:04 UTC
Created attachment 6488 [details]

Comment 2 Jonathan Pryor 2014-04-03 12:19:46 UTC
One interesting thing is that Xamarin.Android has "fixup" logic to convert C# names within .axml files into the corresponding java ACW names, so that <Scratch.CustomRootView.MyScrollView/> becomes <scratch.customrootview.MyScrollView>.

That isn't happening if <Scratch.CustomRootView.MyScrollView/> is the root element. :-/

If I manually "fix" Resources\Layout\Main.axml file to use <scratch.customrootview.MyScrollView/> instead of <Scratch.CustomRootView.MyScrollView/>, then the sample works as expected.

It is because the root element isn't "fixed" that the ClassNotFoundException is generated.
Comment 3 Atsushi Eno 2014-07-30 15:31:43 UTC
Fixed. Thanks for the report.

[master 987c8ea]
Comment 4 Danish Akhtar 2014-08-05 12:43:00 UTC
Today, I have checked this issue with attached project in comment 1. Now this issue is not exists sample is runnig successfully, without any error.

Hence closing this issue.

Environment info:
=== Xamarin Studio ===

Version 5.3 (build 412)
Installation UUID: 3dbf10c4-ed30-4e55-8a8b-1704777c7b5f
	Mono 3.8.0 ((no/9ffca33)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308000002

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 606f31a
Build date: 2014-08-01 15:27:48-0400

=== Xamarin.Android ===

Version: 4.16.0 (Enterprise Edition)
Android SDK: /Users/apprpject/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Build Information ===

Release ID: 503000412
Git revision: 77e042831804079a649ee83092ed36c7c10773a2
Build date: 2014-08-01 06:32:22-04
Xamarin addins: 57e379e6a9454a1c0d97aa3f770e7ae7cc16c522

=== Operating System ===

Mac OS X 10.8.5
Darwin localhost 12.5.0 Darwin Kernel Version 12.5.0
    Sun Sep 29 13:33:47 PDT 2013
    root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64