Bug 23673 - setAllowUniversalAccessFromFileURLs missing from WebSettings class
Summary: setAllowUniversalAccessFromFileURLs missing from WebSettings class
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.18.0
Hardware: All Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
: 7775 ()
Depends on:
Reported: 2014-10-07 17:02 UTC by Mohan
Modified: 2014-11-04 11:43 UTC (History)
4 users (show)

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

`Android.Webkit.WebSettings' does not contain a definition for `AllowUniversalAccessFromFileURLs' Error (111.79 KB, text/plain)
2014-10-08 03:43 UTC, Satya

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 Mohan 2014-10-07 17:02:20 UTC
The setAllowUniversalAccessFromFileURLs method of WebSettings was added in API
16, but it does not appear to be present in the Mono for Android API 4.2.6.


This is a duplicate of Issue#7775. 
This is a critical issue now as this does not allow the Xamarin based Android Applications built on top of WebView not to run the web application whose minimim sdk version is set to 19.

How to reproduce the issue ::::
Create a webview Android WebView Application using Xamarin Studio.
Make sure the assets does have the html files and js files

Build the Android package and run the application on the device.
Expected Result : Android application should show the pages created
Actual Result : Android application is invoked with a white screen
Comment 1 Jonathan Pryor 2014-10-07 22:19:33 UTC
Many Java methods are mapped to C# properties, particularly if there is a get and set method with the same suffix and matching values:


In this case, WebSettings.setAllowUniversalAccessFromFileURLs(boolean) was mapped to the WebSettings.AllowUniversalAccessFromFileURLs property:

Comment 2 Jonathan Pryor 2014-10-07 22:19:44 UTC
*** Bug 7775 has been marked as a duplicate of this bug. ***
Comment 3 Satya 2014-10-08 03:43:38 UTC
Created attachment 8349 [details]
`Android.Webkit.WebSettings' does not contain a definition for `AllowUniversalAccessFromFileURLs' Error

After your suggestion we have tried to use AllowUniversalAccessFromFileURLs property. But we could not find this as well. PFA error(Error CS0117: `Android.Webkit.WebSettings' does not contain a definition for `AllowUniversalAccessFromFileURLs' (CS0117) ) screen shot for your reference. Also we have browsed WebSettings methods and properties in the assembly browser, still no luck. Please advise.
Comment 4 Mohan 2014-10-08 07:41:48 UTC
Please find the comments from Satya,
Comment 5 Jonathan Pryor 2014-10-08 07:43:39 UTC
What is your $(TargetFrameworkVersion)? WebSettings.AllowUniversalAccessFromFileURLs was added in API-16, so your $(TargetFrameworkVersion) must be v4.1 or higher.
Comment 6 Satya 2014-10-08 10:37:58 UTC
After changing the targetFramework version it works fine.Thanks a lot Jonathan.
Comment 7 Mohit Kheterpal 2014-11-04 11:43:16 UTC
As per comment 6, this issue is working fine now.

Hence closing this issue.