0
MonoDroid Professionalによって生成されるapkファイルのファイルサイズは非常に大きく(18MB)、SDKアセンブリでリンクを呼び出すことで縮小しようとしています( 'SDKアセンブリのみ'を選択建物)。残念ながら、これは失敗します。ここで単純なAsyncTaskでMonodroid Linkerが失敗する
は、問題を実証テストコードです:
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):
私があれば11メガバイトにファイルサイズを小さくすることができますよAndroidLinkSkipをPropertyGroupとして使用して、MonoAndroid.dllのリンクをスキップします。ご協力いただきありがとうございます。
ありがとうございましたMatthew!あなたは上に座っています。提案通りにコードを変更し、ファイルサイズを4.4MBに抑えることができました。それはすぐにうまくいく! –
@IronHarryありがとう!それがうまくいくなら、あなたは私の答えを受け入れることができます - それは他の人が答えを見つけるのを助けます(そして私はもう少し担当者が必要です);-) – Matthew