我正在尝试使用MatriX.Xamarin.Android
软件包在Xamarin上创建一个xmpp客户端。我的主要活动上运行了以下非常基本的代码:
using Android.OS;
using Android.Widget;
using Matrix;
using Matrix.Xmpp.Client;
namespace XmppAndroid
{
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.activity_main);
var button = FindViewById<Button>(Resource.Id.button);
button.Click += delegate
{
var jid = new Jid("username@domain.com");
var client = new XmppClient(jid);
client.Password = "123456";
client.OnLogin += delegate
{
Toast.MakeText(this, "Logged!", ToastLength.Short).Show();
};
client.Open();
};
}
}
}
当我尝试运行此代码并按下按钮时,什么也没有发生,并且我在日志中收到以下消息:
12-10 17:49:20.409 W/oid.XmppAndroid(24630): type=1400 audit(0.0:6783): avc: denied { read } for name="u:object_r:net_dns_prop:s0" dev="tmpfs" ino=17213 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:net_dns_prop:s0 tclass=file permissive=0
12-10 17:49:20.411 E/libc (24630): Access denied finding property "net.dns1"
12-10 17:49:20.409 W/oid.XmppAndroid(24630): type=1400 audit(0.0:6784): avc: denied { read } for name="u:object_r:net_dns_prop:s0" dev="tmpfs" ino=17213 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:net_dns_prop:s0 tclass=file permissive=0
12-10 17:49:20.409 W/oid.XmppAndroid(24630): type=1400 audit(0.0:6785): avc: denied { read } for name="u:object_r:net_dns_prop:s0" dev="tmpfs" ino=17213 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:net_dns_prop:s0 tclass=file permissive=0
12-10 17:49:20.413 E/libc (24630): Access denied finding property "net.dns2"
12-10 17:49:20.409 W/oid.XmppAndroid(24630): type=1400 audit(0.0:6786): avc: denied { read } for name="u:object_r:net_dns_prop:s0" dev="tmpfs" ino=17213 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:net_dns_prop:s0 tclass=file permissive=0
12-10 17:49:20.413 E/libc (24630): Access denied finding property "net.dns3"
12-10 17:49:20.414 E/libc (24630): Access denied finding property "net.dns4"
我真的不知道如何解决这个问题。任何帮助都将受到欢迎。