ViewCompat$OnUnhandledKeyEventListener on setContentView

前端 未结 1 892
小蘑菇
小蘑菇 2021-02-19 04:06

the error is triggered by the command:

setContentView(R.layout.activity_item_list);

this code was generated by android studio , when creating a

1条回答
  •  离开以前
    2021-02-19 04:52

    1. I stumbled on a github snippet that does the trick

    you should paste the following to the bottom of your project's - build.gradle

    // This is to fix the errors : java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
    configurations.all {
        resolutionStrategy.eachDependency { details ->
            def requested = details.requested
            if (requested.group == "com.android.support") {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion "26.+"
                }
            }
        }
    }
    
    1. i ended up using the suggestion in the URL below (instead of 1) -

    developer.android.com/studio/build/multidex

    0 讨论(0)
提交回复
热议问题