Xamarin的ClassNotFoundException
我是新来Xamarin并写了一个简单的应用程序,但它显示了以下错误Xamarin的ClassNotFoundException
Unhandled Exception: Java.Lang.ClassNotFoundException: md5c178831cd46fc53bebc42cf953f78ced.SignupActivity
occurred
我对MainActivity
代码:
using Android.App; using Android.Widget;
using Android.OS;
namespace AndroidApp1
{
[Activity(Label = "Hello Xamarin", MainLauncher = true)]
public class MainActivity : Activity
{
private Button loginButton;
private Button signupButton;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Main);
loginButton = (Button)FindViewById(Resource.Id.login_btn);
signupButton = (Button)FindViewById(Resource.Id.signup_btn);
signupButton.Click += delegate
{
StartActivity(typeof(SignupActivity));
};
}
}
}
而对于SignupActivity
:
using System.Text; using Android.App;
using Android.OS;
using Android.Widget;
namespace AndroidApp1
{
[Activity(Label = "SignupActivity")]
public class SignupActivity : Activity
{
private EditText nameField;
private EditText usernameField;
private EditText passwordField;
private EditText emailField;
private Button signup;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.SignupLayout);
nameField = (EditText)FindViewById(Resource.Id.name);
usernameField = (EditText)FindViewById(Resource.Id.username);
emailField = (EditText)FindViewById(Resource.Id.email);
passwordField = (EditText)FindViewById(Resource.Id.password);
signup = (Button)FindViewById(Resource.Id.signup_btn);
signup.Click += delegate
{
StringBuilder sb = new StringBuilder();
sb.AppendLine(nameField.Text);
sb.AppendLine(usernameField.Text);
sb.AppendLine(emailField.Text);
sb.AppendLine(passwordField.Text);
Toast.MakeText(this, sb.ToString(), ToastLength.Short).Show();
};
}
}
}
你能告诉我我的错在哪里?谢谢。
编辑: 清单文件
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="AndroidApp1.AndroidApp1"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="21" />
<application android:allowBackup="true" android:label="@string/app_name">
</application>
</manifest>
回答:
这是一个已知的bug,清洁,再建项目,通常可以解决它。
以上是 Xamarin的ClassNotFoundException 的全部内容, 来源链接: utcz.com/qa/264367.html