1

i was using android support v7 recyclerView in my xml layout file in android


      <android.support.v7.widget.RecyclerView
            android:id="@+id/messagelist"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:clipToPadding="false"
            android:scrollbars="vertical" />

i switched to androidx so i changed the recycler view to androidx recyclerView like this :

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/messagelist"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:clipToPadding="false"
            android:scrollbars="vertical" />

so i got this error :

    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.yassineghr.chatdemov2-2/base.apk"],nativeLibraryDirectories=[/data/app/com.yassineghr.chatdemov2-2/lib/x86, /system/lib, /vendor/lib]]

this is my gradle build file :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.yassineghr.chatdemov2"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == "androidx") {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion "${targetSdk}.+"
                }
            }
        }
    }

}

CoderTn
  • 985
  • 2
  • 22
  • 49
  • Try [this](https://github.com/facebook/flipper/issues/146) – Onik Dec 24 '19 at 18:57
  • @Onik already tried still having the same error – CoderTn Dec 24 '19 at 19:00
  • @Onik despite down-voted -3, this is the only way to prevent it: one [stupid answer](https://stackoverflow.com/a/56288098/549372) of mine... and it is perfectly safe to ignore this error, when running on elder devices. – Martin Zeitler Dec 24 '19 at 20:02
  • You might consider the answer owner to undelete it as it helped you :) – Onik Dec 24 '19 at 20:04
  • It's not deleted, but only grayed out due to down-votes. I just kept it, because it illustrates the actual problem. When running on later API levels >= 28, this incompatibility doesn't exist... the best one could do is to filter the logcat output, in case one finds it annoying. – Martin Zeitler Dec 24 '19 at 20:11

0 Answers0