应用程序在启动时崩溃

时间:2016-11-11 16:57:57

标签: java android exception android-activity

有一个应用程序,我一直在努力。每当我在我的设备上运行应用程序时似乎无法弄清楚问题。这是我运行应用程序时的logcat。

window.print();

我的Android Manifest如下:

11-11 22:21:01.917 2064-2064/? E/AndroidRuntime: FATAL EXCEPTION: main
                                             Process: com.example.android.timeforacoffee, PID: 2064
                                             java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.timeforacoffee/com.example.android.timeforacoffee.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.android.timeforacoffee.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.timeforacoffee-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.android.timeforacoffee-1/lib/arm64, /vendor/lib64, /system/lib64]]
                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2566)
                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2725)
                                                 at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1572)
                                                 at android.os.Handler.dispatchMessage(Handler.java:111)
                                                 at android.os.Looper.loop(Looper.java:207)
                                                 at android.app.ActivityThread.main(ActivityThread.java:5896)
                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
                                              Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.timeforacoffee.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.timeforacoffee-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.android.timeforacoffee-1/lib/arm64, /vendor/lib64, /system/lib64]]
                                                 at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                 at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                 at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                 at android.app.Instrumentation.newActivity(Instrumentation.java:1072)
                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2556)
                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2725) 
                                                 at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1572) 
                                                 at android.os.Handler.dispatchMessage(Handler.java:111) 
                                                 at android.os.Looper.loop(Looper.java:207) 
                                                 at android.app.ActivityThread.main(ActivityThread.java:5896) 
                                                 at java.lang.reflect.Method.invoke(Native Method) 
                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
                                                Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.example.android.timeforacoffee.MainActivity" on path: DexPathList[[dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-support-annotations-24.2.1_96dec127ae08ed7d09cd8e50d59e153fe09eff44-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-internal_impl-24.2.1_e6f2b5c2677fe7bed0a9a175ec8510d0067c0bb8-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-internal_impl-24.2.1_db2fc7a0fd59eaaca41c0078cc1bf01aa7539ba6-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-internal_impl-24.2.1_acf3c442cf3249ba0d4ba8de44f83da826715f04-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-internal_impl-24.2.1_9e08c46bb4202676e7061f6e8808197f4d6d80d9-classes.dex", dex file "/data/data/com.example.android.timeforacoffee/files/instant-run/dex/slice-internal_impl-24.2.1_6f14fc144bd45ad6ad21cb47f6c557ceb08dcd76-classes.dex", dex file "/data/data/com.examp

<?xml version="1.0" encoding="utf-8"?>

XML代码:

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

0 个答案:

没有答案