[英]Java.Lang.NoClassDefFoundError: Timeout exceeded getting exception details Xamarin Android
After following a tutorial when i try to run my code i get Java.Lang.NoClassDefFoundError: Timeout exceeded getting exception details
on app start.I tried clean
and Rebuild
but it doesn't fix it. 在按照教程尝试运行代码后,我得到了Java.Lang.NoClassDefFoundError: Timeout exceeded getting exception details
在应用启动时Java.Lang.NoClassDefFoundError: Timeout exceeded getting exception details
。我尝试了clean
和Rebuild
但并没有解决它。 When i try to debug i noticed that its on the onCreate
method but i am not understanding the reason its throwing exception since the code has not error on build. 当我尝试调试时,我注意到它在onCreate
方法上,但是我不理解其引发异常的原因,因为代码在构建时没有错误。
Below is the code in the base.onCreate
method 下面是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");
}
}
Manifest File 清单文件
<?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,确保“活动”正确添加,并检查位置权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.