Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Starting from Android API Level 23, StrictMode is able to detect clear-text network traffic and dump an error into logcat. This is via the following methods:
When targeting and running on an Android 23 / L device, these APIs are accessible through the Java reflection API. We can pull the method out and invoke them like so:
var builder = new StrictMode.VmPolicy.Builder ();
var methods = builder.Class.GetMethods ();
var clearTextMethod = builder.Class.GetMethod ("detectCleartextNetwork");
builder = clearTextMethod.Invoke (builder) as StrictMode.VmPolicy.Builder;
While this is a workaround, it's not ideal. Can these methods be exposed through the Xamarin.Android runtime api?
=== Xamarin Studio ===
Version 5.10.2 (build 56)
Installation UUID: 0c4328cb-e1b1-4543-8254-d92b3ee4da80
Mono 4.2.2 (explicit/996df3c Wed Jan 20 00:19:48 EST 2016)
GTK+ 2.24.23 (Raleigh theme)
Package version: 402020030
=== Xamarin.Profiler ===
=== Xamarin.Android ===
Version: 126.96.36.199 (Business Edition)
Android SDK: /Users/matthewrobbins/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.3 (API level 10)
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)
4.4.87 (API level 20)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.2
Java SDK: /usr
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
=== Xamarin Android Player ===
Location: /Applications/Xamarin Android Player.app
=== Apple Developer Tools ===
Xcode 7.2.1 (9548.1)
=== Xamarin.iOS ===
Version: 188.8.131.52 (Business Edition)
Build date: 2016-01-29 16:59:11-0500
=== Xamarin.Mac ===
Version: 184.108.40.206 (Starter Edition)
=== Build Information ===
Release ID: 510020056
Git revision: bb74ff467c62ded42b7b7ac7fdd2edc60f8647b0
Build date: 2016-01-26 16:24:41-05
Xamarin addins: 8b797d7ba24d5abab226c2cf9fda77f666263f1b
Build lane: monodevelop-lion-cycle6-c6sr1
=== Operating System ===
Mac OS X 10.11.3
Darwin JobAdders-iMac-6.local 15.3.0 Darwin Kernel Version 15.3.0
Thu Dec 10 18:40:58 PST 2015
> Can these methods be exposed through the Xamarin.Android runtime api?
Are they actually missing?
> $ monop -r:/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild-frameworks/MonoAndroid/v6.0/Mono.Android.dll \
Android.OS.StrictMode | grep DetectClear
public Builder DetectCleartextNetwork ();
It appears to be there for me...
Unfortunately our documentation site hasn't been updated for API-23 yet, but the bindings have been.
I'll double check when I get back to my desk but auto-completion doesn't suggest them nor does it compile.
I'm currently on the latest revision of the Stable channel.
Will confirm in an hour.
Created attachment 14997 [details]
Scrrenshot of the android manifest.
Attached is a screenshot of the manifest for the project.
Created attachment 14998 [details]
Screenshot for the VM policy builder binding code.
Attached is a screen shot of the vm policy builder binding.
I'll upgrade to Alpha and Beta to verify.
What is the $(TargetFrameworkVersion) value in your .csproj? It needs to be v6.0.
Additionally, Comment #2 is from the currents table:
> $ /Developer/MonoAndroid/usr/bin/mandroid --version
> mandroid 220.127.116.11707959
That was it! Thanks for the help Jonathon.