Android Studio 3.1 does not render xml file due to a java class missing

后端 未结 5 1269
余生分开走
余生分开走 2020-12-29 09:55

Always shows me the error in the massages

java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener

My pr

5条回答
  •  伪装坚强ぢ
    2020-12-29 10:48

    - Use Alpha/Beta at your Own Risk

    • You are developing an app, so you don't want to face these types of issues. So I suggest you use always stable version of every dependency.

    The issue you faced was due to using alpha version of AppCompat library. Use stable version to get rid of this issue now and in future.

    1. Use android.support stable version

    Currently 27.1.1 is latest version of AppComactV7. You can see Maven Repo link to find out latest.

    final def SUPPORT_VERSION = "27.1.1"
    implementation "com.android.support:appcompat-v7:$SUPPORT_VERSION"
    implementation "com.android.support:design:$SUPPORT_VERSION" // use only if already using
    

    I use definitions to have same version for all support versions. Also ignore design library if you are not already using it.

    2. Downgrade compileSdkVersion and targetSdkVersion (Optional)

    You also need to downgrade your compileSdkVersion & targetSdkVersion to remove some gradle warnings.

    so use below versions

    compileSdkVersion 27 
    targetSdkVersion 27
    

    Read about Alpha & Beta releases.

提交回复
热议问题