Размер файла apk, сгенерированного MonoDroid Professional, очень велик (18 МБ), и я пытаюсь уменьшить его, вызывая ссылки на сборки SDK (выберите «Только сборки SDK» при сборке).К сожалению, это не удается.
Вот тестовый код, который демонстрирует проблему:
TestAsyncTask : AsyncTask<MyInt, int, int>
{
Activity1 _myActivity;
public TestAsyncTask(Activity1 activity)
: base()
{
_myActivity = activity;
}
protected override void OnPreExecute()
{
}
protected override int RunInBackground(params MyInt[] @params)
{
int taget = @params[0].IntValue;
Android.Util.Log.Debug("RunInBackground", taget.ToString());
System.Threading.Thread.CurrentThread.Join(1000);
return taget;
}
protected override void OnPostExecute(int results)
{
_myActivity.textView1.Text = results + " Complete!";
}
}
public class MyInt : Java.Lang.Object
{
public int IntValue;
}
и вот результат, полученный при его запуске на устройстве:
UNHANDLED EXCEPTION: System.ArgumentException: Couldn't bind to method 'GetDoInBackground_arrayLjava_lang_Object_Handler'.
at System.Delegate.GetCandidateMethod (System.Type,System.Type,string,System.Reflection.BindingFlags,bool,bool) <IL 0x0010c, 0x00728>
at System.Delegate.CreateDelegate (System.Type,System.Type,string,bool,bool) <IL 0x00018, 0x000f7>
at System.Delegate.CreateDelegate (System.Type,System.Type,string) <IL 0x00005, 0x00063>
at Android.Runtime.JNIEnv.RegisterJniNatives (intptr,int,intptr,intptr,int) <IL 0x00175, 0x00a03>
at (wrapper delegate-invoke) <Module>.invoke_intptr__this___intptr_intptr_string_string (intptr,intptr,string,string) <IL 0x0005d, 0x00117>
at Android.Runtime.JNIEnv.GetMethodID (intptr,string,string) <IL 0x00012, 0x000a7>
at Android.Runtime.JNIEnv.CreateInstance (intptr,string,Android.Runtime.JValue[]) <IL 0x00007, 0x00063>
at Android.Runtime.JNIEnv.CreateInstance (System.Type,string,Android.Runtime.JValue[]) <IL 0x0000a, 0x00093>
at Android.OS.AsyncTask`3<MonoAndroidApplication1.MyInt, int, int>..ctor () <IL 0x00049, 0x0015b>
at MonoAndroidApplication1.TestAsyncTask..ctor (MonoAndroidApplication1.Activity1) <IL 0x00001, 0x0005b>
at MonoAndroidApplication1.Activity1.OnCreate (Android.OS.Bundle) <IL 0x00035, 0x00213>
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <IL 0x00012, 0x000e7>
at (wrapper dynamic-method) object.8bb95c67-1299-4094-bc2d-2b10b61aa06b (intptr,intptr,intptr) <IL 0x00012, 0x00033>
03-09 14:17:04.623 E/mono (20045):
IЯ могу уменьшить размер файла до 11 МБ, если я пропускаю ссылки на MonoAndroid.dll, используя AndroidLinkSkip в качестве PropertyGroup.Спасибо за вашу помощь.