OnUnhandledKeyEventListener未知错误

时间:2018-07-02 14:47:12

标签: java android material-design

我收到此错误:

  

拒绝对先前失败的类java.lang.Class进行重新初始化

我已经花了数小时搜索Google,却找不到原因,令我感到困惑的是,该应用程序在v28之前的API上运行。 但是在运行api 28的所有设备上崩溃都不会失败

  

下面附有Logcat:

07-02 12:59:51.667 18223-18223/? I/art: Not late-enabling -Xcheck:jni (already on)
07-02 12:59:51.699 18223-18233/? I/art: Debugger is no longer active
07-02 12:59:51.752 18223-18223/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-02 12:59:51.775 18223-18223/? I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
07-02 12:59:52.248 18223-18241/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
07-02 12:59:52.256 18223-18223/? D/Atlas: Validating map...
07-02 12:59:52.295 18223-18241/? I/OpenGLRenderer: Initialized EGL, version 1.4
07-02 12:59:52.296 18223-18241/? W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
07-02 12:59:52.300 18223-18241/? D/EGL_emulation: eglCreateContext: 0x7f42be844b60: maj 2 min 0 rcv 2
07-02 12:59:52.320 18223-18241/? D/EGL_emulation: eglMakeCurrent: 0x7f42be844b60: ver 2 0
07-02 12:59:52.326 18223-18241/? D/OpenGLRenderer: Enabling debug mode 0
07-02 12:59:52.344 18223-18241/? D/EGL_emulation: eglMakeCurrent: 0x7f42be844b60: ver 2 0
07-02 12:59:53.408 18223-18223/freeskate.esk8hub.skatehub I/Choreographer: Skipped 60 frames!  The application may be doing too much work on its main thread.
07-02 12:59:51.667 18223-18223/? I/art: Not late-enabling -Xcheck:jni (already on)
07-02 12:59:51.699 18223-18233/? I/art: Debugger is no longer active
07-02 12:59:51.752 18223-18223/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
07-02 12:59:51.775 18223-18223/? I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
    Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
07-02 12:59:52.248 18223-18241/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
07-02 12:59:52.256 18223-18223/? D/Atlas: Validating map...
07-02 12:59:52.295 18223-18241/? I/OpenGLRenderer: Initialized EGL, version 1.4
07-02 12:59:52.296 18223-18241/? W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
07-02 12:59:52.300 18223-18241/? D/EGL_emulation: eglCreateContext: 0x7f42be844b60: maj 2 min 0 rcv 2
07-02 12:59:52.320 18223-18241/? D/EGL_emulation: eglMakeCurrent: 0x7f42be844b60: ver 2 0
07-02 12:59:52.326 18223-18241/? D/OpenGLRenderer: Enabling debug mode 0
07-02 12:59:52.344 18223-18241/? D/EGL_emulation: eglMakeCurrent: 0x7f42be844b60: ver 2 0
07-02 12:59:53.408 18223-18223/? I/Choreographer: Skipped 60 frames!  The application may be doing too much work on its main thread.
07-02 13:32:22.589 18223-18233/? I/art: Debugger is no longer active

在该应用程序中,我至今尚未使用任何事件侦听器,唯一监听点击的是导航抽屉,这是Android Studio中的预制活动。

  

以下是用于处理活动抽屉的Java:

int id = item.getItemId();

        //Below we will instantiate the fragments into the nav-view. Instead of hiding and showing individual elements manually

        if (id == R.id.nav_login) {
            //Handle login action
            fragmentTransaction = getSupportFragmentManager().beginTransaction();
            fragmentTransaction.replace(R.id.main_container, new Login());
            fragmentTransaction.commit();
            getSupportActionBar().setTitle("Login");

        } else if (id == R.id.nav_register) {
            //Handle register action
            fragmentTransaction = getSupportFragmentManager().beginTransaction();
            fragmentTransaction.replace(R.id.main_container, new Register());
            fragmentTransaction.commit();
            getSupportActionBar().setTitle("Register");

        } else if (id == R.id.nav_support) {
            //Handle support action.
            fragmentTransaction = getSupportFragmentManager().beginTransaction();
            fragmentTransaction.replace(R.id.main_container, new Support());
            fragmentTransaction.commit();
            getSupportActionBar().setTitle("Support");
        }

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
  

片段在onCreate函数中处理

//Lets add the fragments to the frame layout in the design file.
fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.main_container, new Login());
fragmentTransaction.commit();
getSupportActionBar().setTitle("Login");

有人可以在这里看到任何问题吗?我已经尝试了几个小时,但似乎找不到解决方法。

0 个答案:

没有答案