导航抽屉无法实例化应用程序java.lang.classnotfoundexception

时间:2015-02-23 20:51:07

标签: class navigation drawer

我正在开发一款应用。在这部分我只有一个导航抽屉的活动。

m trying to run but I get the same Exception everytime.. I搜索了一段时间,尝试过很多事情,但没有任何效果。

这是我的logcat:

02-23 17:45:09.379: E/AndroidRuntime(3364): FATAL EXCEPTION: main
02-23 17:45:09.379: E/AndroidRuntime(3364): Process:       com.example.testedrawer, PID: 3364
02-23 17:45:09.379: E/AndroidRuntime(3364): java.lang.RuntimeException:  Unable to instantiate activity ComponentInfo{com.example.testedrawer/com.example.testedrawer.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.testedrawer.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.testedrawer-2/base.apk"],nativeLibraryDirectories= [/vendor/lib, /system/lib]]
02-23 17:45:09.379: E/AndroidRuntime(3364):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at android.app.ActivityThread.access$800(ActivityThread.java:144)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at android.os.Handler.dispatchMessage(Handler.java:102)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at android.os.Looper.loop(Looper.java:135)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at android.app.ActivityThread.main(ActivityThread.java:5221)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at java.lang.reflect.Method.invoke(Native Method)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at java.lang.reflect.Method.invoke(Method.java:372)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
02-23 17:45:09.379: E/AndroidRuntime(3364):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
02-23 17:45:09.379: E/AndroidRuntime(3364): Caused by:  java.lang.ClassNotFoundException: Didn't find class "com.example.testedrawer.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.testedrawer-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
02-23 17:45:09.379: E/AndroidRuntime(3364):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
02-23 17:45:09.379: E/AndroidRuntime(3364):     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

我的清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testedrawer"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="21" />
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        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>

请帮帮我..

1 个答案:

答案 0 :(得分:0)

我已经修好了。我尝试过很多在Eclipse上无法工作的东西。比我尝试在Android Studio上做的..它工作了!谢谢你的帮助!