android项目中的java.lang.NoClassDefFoundError错误

时间:2015-07-08 03:59:11

标签: java android jar noclassdeffounderror executable-jar

我制作了一个包含以下罐子的项目。

enter image description here

在构建路径中如下

enter image description here

Main.java

public class Main extends Activity
{

    public int welcomeScreenDisplay = 1000;
    boolean ispr=false;
    @Override
    protected void onCreate(Bundle savedInstanceState)
        {
            // TODO Auto-generated method stub

            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
            setContentView(R.layout.splash);


            /** create a thread to show splash up to splash time */

            Thread welcomeThread = new Thread() {
                int wait = 0;

                @Override
                public void run() {
                    try {
                        super.run();

                        while (wait < welcomeScreenDisplay) {
                            sleep(100);
                            wait += 100;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    } finally {


                            Intent mIntent=new Intent(getApplicationContext(), DrawerActivity .class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                            startActivity(mIntent);
                            finish();



                    }
                }
            };
            welcomeThread.start();
        }

        }

DrawerActivity.java

 package com.pkg.name;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

 public class DrawerActivity extends FragmentActivity  {

 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.spinner_year);
    }
}

的Manifest.xml

  <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pkg.name"
android:versionCode="1"
android:versionName="1.0" >

 <uses-sdk android:minSdkVersion="11" />



<application
    android:allowBackup="true"
    android:icon="@drawable/app_icon"
    android:label="@string/app_name"

    android:theme="@style/CustomActionBarTheme" >


    <activity
        android:name="com.pkg.name.Splash"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden|stateVisible" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.pkg.name.DrawerActivity"
         android:screenOrientation="portrait"
    android:theme="@style/AppBaseTheme"
    android:windowSoftInputMode="stateHidden|stateVisible" >
    </activity>
   </application>

  </manifest>

当我在设备中运行我的应用程序时,它会给我一个错误,如

  FATAL EXCEPTION: Thread-912
  java.lang.NoClassDefFoundError:com.pkg.name.DrawerActivity
  at com.pkg.name.Splash$1.run(Splash.java:53)

任何想法我怎么能解决这个问题?你的所有建议都很明显。

0 个答案:

没有答案