Xamarin Forms Android服务在mscorlib.dll中启动后立即崩溃

Xamarin Forms Android服务在mscorlib.dll中启动后立即崩溃,xamarin,xamarin.android,xamarin.forms,background-process,mscorlib,Xamarin,Xamarin.android,Xamarin.forms,Background Process,Mscorlib,我想在启动时运行我的后台服务,我在Android上使用Xamarin表单。我按照Rob Gibbens的伟大示例“LongRunningTaskService”创建了该服务 它工作得很好,但我需要它在启动时,而不是由用户界面触发。我在启动时添加了该服务,在mscorlib.dll中启动后立即出现崩溃。即使删除了所有代码,并且没有对广播侦听器执行任何操作,也会发生崩溃 这里是广播听众 using Android.App; using Android.Content; namespace Forms

我想在启动时运行我的后台服务,我在Android上使用Xamarin表单。我按照Rob Gibbens的伟大示例“LongRunningTaskService”创建了该服务 它工作得很好,但我需要它在启动时,而不是由用户界面触发。我在启动时添加了该服务,在mscorlib.dll中启动后立即出现崩溃。即使删除了所有代码,并且没有对广播侦听器执行任何操作,也会发生崩溃

这里是广播听众

using Android.App;
using Android.Content;
namespace FormsBackgrounding.Droid
{
    [BroadcastReceiver(Enabled = true)]
    [IntentFilter(new[] { Android.Content.Intent.ActionBootCompleted })]
    public class StartReceiver : BroadcastReceiver
    {
        public override void OnReceive(Context context, Intent intent)
        {
            //if (intent.Action == Intent.ActionBootCompleted)
            //{ 
                //Intent timerIntent = new Intent(context, typeof(LongRunningTaskService));
               //Application.Context.StartService(timerIntent);
            //}
        }
    }
}
这是舱单

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.arteksoftware.formsbackgrounding">
    <uses-sdk android:minSdkVersion="16" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <application android:label="FormsBackgrounding">
    <receiver android:name="StartReceiver">
         <intent-filter>
         <action android:name="android.intent.action.BOOT_COMPLETED" />
         </intent-filter>
    </receiver>
    <service android:name=".LongRunningTaskService" ></service>
    </application>
</manifest>

从原木上坠落

Assembly Loader probing location: '/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.__override__/mscorlib.dll'.
 637): The first listener is added
Image addref mscorlib[0xe1bfe280] -> /storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.__override__/mscorlib.dll[0xeaf8c800]: 2
Prepared to set up assembly 'mscorlib' (/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.__override__/mscorlib.dll)
AOT module '/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.__override__/mscorlib.dll.so' not found: dlopen failed: library "/data/app/
/lib/x86/libaot-mscorlib.dll.so" not found
AOT module '/Users/builder/data/lanes/4009/df84ee74/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/mscorlib.dll.so' not found: dlopen failed: library "/data/app/
/lib/x86/libaot-mscorlib.dll.so" not found
Assembly Loader loaded assembly from location: '/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.__override__/mscorlib.dll'.
Config attempting to parse: '/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.__override__/mscorlib.dll.config'.
Config attempting to parse: '/Users/builder/data/lanes/4009/df84ee74/source/monodroid/builds/install/mono-x86/etc/mono/assemblies/mscorlib/mscorlib.config'.
mono_threads_platform_set_priority: unknown policy 3
Fatal signal 6 (SIGABRT), code -6 in tid 1462 (msbackgrounding)
debuggerd: handling request: pid=1445 uid=10068 gid=10068 tid=1462
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Android/vbox86p/vbox86p:7.0/NRD90M/genymo09131924:userdebug/test-keys'
Revision: '0'
ABI: 'x86'
pid: 1445, tid: 1462, name: msbackgrounding  >>> com.arteksoftware.formsbackgrounding <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'mono_threads_platform_set_priority: unknown policy 3'
    eax 00000000  ebx 000005a5  ecx 000005b6  edx 00000006
    esi cd3ef978  edi cd3ef920
    xcs 00000023  xds 0000002b  xes 0000002b  xfs 0000006b  xss 0000002b
    eip ef775bb9  ebp cd3ef748  esp cd3ef6ec  flags 00000292

backtrace:
    #00 pc 00000bb9  [vdso:ef775000] (__kernel_vsyscall+9)
    #01 pc 0007a2ec  /system/lib/libc.so (tgkill+28)
    #02 pc 00075b35  /system/lib/libc.so (pthread_kill+85)
    #03 pc 0002784a  /system/lib/libc.so (raise+42)
    #04 pc 0001ee26  /system/lib/libc.so (abort+86)
    #05 pc 00270657  /data/app/Mono.Android.DebugRuntime-1/lib/x86/libmonosgen-32bit-2.0.so
程序集加载程序探测位置:'/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.\uuuu override\uuuu/mscorlib.dll'。
637):添加第一个侦听器
Image addref mscorlib[0xe1bfe280]->/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.uuuuuuu override\uuuuuu/mscorlib.dll[0xeaf8c800]:2
准备好设置程序集“mscorlib”(/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.\uuuu override\uuuuu/mscorlib.dll)
AOT模块'/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.\uuuuu override.\uuuuuu/mscorlib.dll.so'未找到:dlopen失败:library”/data/app/
/lib/x86/libaot mscorlib.dll.so“未找到”
AOT模块'/Users/builder/data/lanes/4009/df84ee74/source/monodroid/builds/install/mono-x86/lib/mono/AOT cache/x86/mscorlib.dll。因此“未找到:dlopen失败:library”/data/app/
/lib/x86/libaot mscorlib.dll.so“未找到”
程序集加载器从以下位置加载程序集:'/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.\uuuu override\uuuuu/mscorlib.dll'。
试图分析的配置:'/storage/emulated/0/Android/data/com.arteksoftware.formsbackgrounding/files/.\uuuu override.\uuuu/mscorlib.dll.Config'。
试图解析的配置:'/Users/builder/data/lanes/4009/df84ee74/source/monodroid/builds/install/mono-x86/etc/mono/assemblies/mscorlib/mscorlib.Config'。
单线程平台设置优先级:未知策略3
tid 1462中的致命信号6(SIGABRT),代码-6(MSBack接地)
调试程序:处理请求:pid=1445 uid=10068 gid=10068 tid=1462
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
构建指纹:“Android/vbox86p/vbox86p:7.0/NRD90M/genymo09131924:userdebug/testkeys”
修订:“0”
ABI:'x86'

pid:1445,tid:1462,名称:msbackgrounding>>>com.arteksoftware.formsbackgrounding能否请您尝试清理项目并在其他设备/模拟器上运行它?我在两个不同的设备(genymotion api 21和api 24)上以及在xamarin android模拟器上进行了尝试,但均未成功。同样的结果