C# Java.Lang.NoClassDefFoundError:获取Xamarin Android中的异常详细信息时超时

C# Java.Lang.NoClassDefFoundError:获取Xamarin Android中的异常详细信息时超时,c#,android,xamarin,C#,Android,Xamarin,当我尝试运行我的代码时,遵循了一个教程之后,我得到了Java.Lang.NoClassDefFoundError:在应用程序启动时获取异常详细信息超过了超时时间。我尝试了clean和Rebuild,但没有修复它。当我尝试调试时,我注意到它在onCreate方法上,但我不理解它引发异常的原因,因为代码在构建时没有错误。 下面是base.onCreate方法中的代码 protected override void OnCreate(Bundle savedInstanceState) {

当我尝试运行我的代码时,遵循了一个教程之后,我得到了
Java.Lang.NoClassDefFoundError:在应用程序启动时获取异常详细信息超过了超时时间。我尝试了
clean
Rebuild
,但没有修复它。当我尝试调试时,我注意到它在
onCreate
方法上,但我不理解它引发异常的原因,因为代码在构建时没有错误。
下面是
base.onCreate
方法中的代码

protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.activity_main);
        locationManager = (LocationManager)GetSystemService(Android.Content.Context.LocationService);
        provider = locationManager.GetBestProvider(new Criteria(), false);
        Location location = locationManager.GetLastKnownLocation(provider);

        if (location == null)
        {
            System.Diagnostics.Debug.WriteLine("No Location");
        }
    }
清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
  android:versionCode="1" android:versionName="1.0" 
  package="XamarinWeatherApp.XamarinWeatherApp" 
  android:installLocation="auto">
  <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" 
   />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
  <uses-permission 
  android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" 
  />
  <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" 
  android:label="@string/app_name" 
  android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" 
  android:theme="@style/AppTheme"></application>
</manifest>

检查manifest.xml,确保活动添加正确,并检查位置权限。
检查manifest.xml,确保活动添加正确,并检查位置权限。

我已经添加了舱单,请检查。您是以这种方式添加的吗?[Activity(Label=“labelName”,Icon=“@drawable/image”,LaunchMode=LaunchMode.SingleTask,ScreenOrientation=ScreenOrientation.肖像,Theme=“@style/MainTheme”,MainLauncher=true,ConfigChanges=ConfigChanges.ScreenSize | ConfigChanges.Orientation)]我已经添加了清单,请检查。您是以这种方式添加的吗?[Activity(Label=“labelName”,Icon=“@drawable/image”,LaunchMode=LaunchMode.SingleTask,ScreenOrientation=ScreenOrientation.肖像,Theme=“@style/MainTheme”,MainLauncher=true,ConfigChanges=ConfigChanges.ScreenSize | ConfigChanges.Orientation)]仅通过查看您发布的信息很难看出问题出在何处。我建议您发布一个演示,以便我们可以为您测试。我应该发布什么信息?如果您愿意,演示是最好的。仅通过查看您发布的信息很难看出问题出在哪里。我建议您发布一个演示,以便我们可以为您测试。我应该发布什么信息?如果您愿意,演示是最好的。