大家帮忙看看这个程序错误信息:java.lang.ClassNotFoundException:wyf.ytl.exmaple2_1_6Activity in loader dalvik.system.pathclassloader@44e8c6a8
这是什么原因呐
java文件:
package wyf.ytl;
import android.app.Activity;//引入相关的包
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.ToggleButton;
import android.util.Log;
public class Example2_1_6 extends Activity implements OnClickListener{
Button button;//普通按钮
ImageButton imageButton;//图片按钮
ToggleButton toggleButton;//开关按钮
TextView textView;//文本控件
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {//回调方法
        super.onCreate(savedInstanceState);
        Log.v("TAG","VERBOSE");   
        Log.d("TAG","DEBUG");   
        Log.i("TAG","INFO");   
        Log.w("TAG","WARN");   
        Log.e("TAG","ERROR");           setContentView(R.layout.main);//设置显示的View
        textView = (TextView) this.findViewById(R.id.textView);
        button = (Button) this.findViewById(R.id.button);
        button.setOnClickListener(this);//为button添加监听器
        imageButton = (ImageButton) this.findViewById(R.id.imageButton);
        imageButton.setOnClickListener(this);//为imageButton添加监听器
        toggleButton = (ToggleButton) this.findViewById(R.id.toggleButton);
        toggleButton.setOnClickListener(this);//为toggleButton添加监听器*/
    }
public void onClick(View v) {//重写的事件处理回调方法
if(v == button){//点击的是普通按钮
textView.setText("您点击的是普通按钮");
}
else if(v == imageButton){//点击的是图片按钮
textView.setText("您点击的是图片按钮");
}
else if(v == toggleButton){//点击的是开关按钮
textView.setText("您点击的是开关按钮");
}
}
}
xml文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView
android:id="@+id/textView"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="您没有点击任何按钮"
/>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="普通按钮"
>
</Button> 
<ImageButton
android:id="@+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img"
>
</ImageButton>
<ToggleButton
android:id="@+id/toggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</ToggleButton>
</LinearLayout>

解决方案 »

  1.   

    java.lang.ClassNotFoundException:wyf.ytl.exmaple2_1_6Activity in loader dalvik.system.pathclassloader@44e8c6a8   
    你的Manifest.xml里Activity名字没写对吧,跟类名一致啊,首字母大写
      

  2.   

    应该是你没有在配置文件中,写上你的activity
      

  3.   

    Manifest.xml里面Activity名字没写错。
      

  4.   

    你的类的path不对
    应该是你的在androidmanifest的类名不对或者是没写。
      

  5.   

    这是我的Manifest.xml文件:
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="wyf.ytl"
          android:versionCode="1"
          android:versionName="1.0">
        <uses-sdk android:minSdkVersion="7" />    <application android:icon="@drawable/icon" android:label="@string/app_name">
            <activity android:name=".Example2_1_6Activity"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>    </application>
        
    </manifest>
      

  6.   


    Manifest.xml里面Activity名字没写错。
      

  7.   

    你的Activity名字是Example2_1_6 不是Example2_1_6Activity~~ 
      

  8.   

    <activity android:name=".Example2_1_6Activity"
      android:label="@string/app_name">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      </activity>java.lang.ClassNotFoundException:wyf.ytl.exmaple2_1_6Activity in loader dalvik.system.pathclassloader@44e8c6a8
    你看下,你这两个类名都不一样,怎么能找的到你的类哦!类名必须相同啊!