我的Android应用程序从logcat给我这个错误:
05-23 14:51:56.058: E/AndroidRuntime(1191): FATAL EXCEPTION: main
05-23 14:51:56.058: E/AndroidRuntime(1191): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mycompany.myapp2/com.mycompany.myapp2.Benvenuto}: java.lang.ClassNotFoundException: com.mycompany.myapp2.Benvenuto
05-23 14:51:56.058: E/AndroidRuntime(1191): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1892)
05-23 14:51:56.058: E/AndroidRuntime(1191): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
05-23 14:51:56.058: E/AndroidRuntime(1191): at android.app.ActivityThread.access$600(ActivityThread.java:127)
05-23 14:51:56.058: E/AndroidRuntime(1191): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
05-23 14:51:56.058: E/AndroidRuntime(1191): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 14:51:56.058: E/AndroidRuntime(1191): at android.os.Looper.loop(Looper.java:137)
05-23 14:51:56.058: E/AndroidRuntime(1191): at android.app.ActivityThread.main(ActivityThread.java:4507)
05-23 14:51:56.058: E/AndroidRuntime(1191): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 14:51:56.058: E/AndroidRuntime(1191): at java.lang.reflect.Method.invoke(Method.java:511)
05-23 14:51:56.058: E/AndroidRuntime(1191): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
05-23 14:51:56.058: E/AndroidRuntime(1191): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
05-23 14:51:56.058: E/AndroidRuntime(1191): at dalvik.system.NativeStart.main(Native Method)
05-23 14:51:56.058: E/AndroidRuntime(1191): Caused by: java.lang.ClassNotFoundException: com.mycompany.myapp2.Benvenuto
05-23 14:51:56.058: E/AndroidRuntime(1191): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
05-23 14:51:56.058: E/AndroidRuntime(1191): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-23 14:51:56.058: E/AndroidRuntime(1191): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-23 14:51:56.058: E/AndroidRuntime(1191): at android.app.Instrumentation.newActivity(Instrumentation.java:1026)
05-23 14:51:56.058: E/AndroidRuntime(1191): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1883)
05-23 14:51:56.058: E/AndroidRuntime(1191): ... 11 more
这是代码的一部分:
public class hi extends Activity {
private final Activity me = this;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.benvenuto);
final EditText inputText = (EditText)findViewById(R.id.inputText);
final TextView outputText = (TextView)findViewById(R.id.outputText);
Button updateButton = (Button)findViewById(R.id.updateButton);
updateButton.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Editable text = inputText.getText();
//text.append(" Appended!");
outputText.setText(text);
}});
Button gioca = (Button)findViewById(R.id.gioca);
gioca.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent inttn = new Intent(me,MainMenu.class);
startActivity(inttn);
}
});
}
任何想法可能是什么问题??
感谢..