ClassNotFoundException: config_inputEventCompatProcessorOverrideClassName androidx, running on andoridx crashes

跟風遠走 提交于 2019-12-11 14:41:55

问题


After Migrating to AndroidX(29) running on the AndroidX device Crashes showing

ClassNotFoundException: config_inputEventCompatProcessorOverrideClassName

the project compiles and runs it crashes when launched in andorid10.0 when clicked on the editText i get this error enter code here

NullPointerException: Attempt to invoke virtual method 'java.util.List android.view.InputEventCompatProcessor.processInputEventForCompatibility(android.view.InputEvent)' on a null object reference

project/build.gradle

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://jitpack.io' }
        google()
    }
    dependencies {
//        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.google.gms:google-services:3.0.0'
//        classpath 'io.fabric.tools:gradle:1.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://maven.google.com' }
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
ext {
    // Sdk and tools
    minSdkVersion = 16
    targetSdkVersion = 26
    compileSdkVersion = 26
    buildToolsVersion = '26.0.0'

    // App dependencies
    supportLibraryVersion = '25.4.0'
    gsonVersion = '2.8.0'
    calligraphyVersion = '2.2.0'
    glideVersion = '3.7.0'
    roomDatabase = '1.0.0-alpha3'
    rx2FastAndroidNetworking = '1.0.0'

    dagger2Version = '2.16'
    rxjava2Version = '2.0.6'
    rxandroidVersion = '2.0.1'
    placeholderviewVersion = '0.6.1'
    debugDBVersion = '1.0.0'
    timberVersion = '4.5.1'
    lifecycle = '1.0.0-alpha3'

    retrofitVersion='2.3.0'
    GsonVersion='2.7'
    okhttpVersion= '3.8.0'
    googleplus= '11.0.0'//'10.2.0'//'11.0.4'
    glideversion= '4.1.1'

    //Test dependencies
    junitVersion = '4.12'
    espressoVersion = '2.2.2'
    mockitoVersion = '2.7.1'
}

app/build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.27.1'
    }
}
android {
    compileSdkVersion 28
    signingConfigs {
        ReleaseConfig {
            keyAlias 'xxxxx'
            keyPassword 'xxxxx'
            storeFile file('../KeyStore/xxxxx.jks')
            storePassword 'xxxxx'
        }
    }
    defaultConfig {
        applicationId "bz.pei.driver"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.ReleaseConfig
        setProperty("archivesBaseName", "PEI Taxi_Driver_v$versionName")

    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    List<String> dirs = [
            'main',     // main sample code; look here for the interesting stuff.
            'common',   // components that are reused by multiple samples
            'template'] // boilerplate code that is generated by the sample template process
    sourceSets {
        main {
            dirs.each { dir ->
                java.srcDirs "src/${dir}/java"
                res.srcDirs "src/${dir}/res"
            }
        }
        androidTest.setRoot('tests')
        androidTest.java.srcDirs = ['tests/src']

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    dataBinding.enabled = true
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //Crashlytics
    implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }
    // dependency injection
    implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
    annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
    annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
    implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"
    //Viewmodel
    implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
    implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okhttpVersion"
    implementation "com.google.android.gms:play-services-auth:$rootProject.googleplus"
    implementation "com.google.android.gms:play-services-maps:$rootProject.googleplus"
    implementation "com.google.android.gms:play-services-location:11.0.0"
    implementation 'com.google.maps.android:android-maps-utils:0.5+'
    implementation 'com.github.javiersantos:AppUpdater:2.7'
    implementation 'com.google.firebase:firebase-core:11.0.0'
    implementation 'com.google.firebase:firebase-messaging:11.0.0'
    implementation "com.github.bumptech.glide:glide:$rootProject.glideversion"
    implementation('io.socket:socket.io-client:1.0.0') {//0.8.3') {
        exclude group: 'org.json', module: 'json'
    }
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.intuit.sdp:sdp-android:1.0.4'
    implementation "com.google.android.gms:play-services-maps:$rootProject.googleplus"
    implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
    testImplementation 'junit:junit:4.12'

}
apply plugin: 'com.google.gms.google-services'
configurations.all {
    resolutionStrategy.force "com.android.support:support-annotations:$supportLibraryVersion"
    resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}

gradle-wrapper.properties

#Wed Nov 20 00:37:33 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
java.lang.ClassNotFoundException: config_inputEventCompatProcessorOverrideClassName
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:454)
    at java.lang.Class.forName(Class.java:379)
    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:635)
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:377)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4296)
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
 Caused by: java.lang.ClassNotFoundException: config_inputEventCompatProcessorOverrideClassName
    at java.lang.Class.classForName(Native Method)
    at java.lang.BootClassLoader.findClass(ClassLoader.java:1358)
    at java.lang.BootClassLoader.loadClass(ClassLoader.java:1418)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at java.lang.Class.classForName(Native Method) 
    at java.lang.Class.forName(Class.java:454) 
    at java.lang.Class.forName(Class.java:379) 
    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:635) 
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:377) 
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95) 
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4296) 
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) 
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) 
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
    at android.os.Handler.dispatchMessage(Handler.java:107) 
    at android.os.Looper.loop(Looper.java:214) 
    at android.app.ActivityThread.main(ActivityThread.java:7356) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 
 Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List android.view.InputEventCompatProcessor.processInputEventForCompatibility(android.view.InputEvent)' on a null object reference
    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7614)
    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:336)
    at android.os.Looper.loop(Looper.java:174)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

2019-11-21 06:41:59.007 27692-27692/bz.pei.driver E/AndroidRuntime: FATAL EXCEPTION: main Process: bz.pei.driver, PID: 27692 java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List android.view.InputEventCompatProcessor.processInputEventForCompatibility(android.view.InputEvent)' on a null object reference at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7614) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:336) at android.os.Looper.loop(Looper.java:174) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)


回答1:


There are a couple of clarifications needed to answer your question

  1. Was the app working fine before you migrated to androidx?

  2. Does the app work without crashing on other devices but crashes on just android 10.0?

  3. did you refactor your package names correctly? If your file names in the manifest or generated code have a package name starting with capital letters, 'class not found exception' could result

You can try pasting (if possible) the Github link to the whole project for proper debugging.

However, from the code you pasted, your minsdkversion= 16 in your project build.gradle ext block differs from the minsdkversion= 15 in your app build.gradle file. The targetsdkversion also differs in the two files




回答2:


thanks for all the support i solved the issues, this was due to the usage of deprecated method, this was not related to migration

@Override
public Resources getResources() {
    return new CustomResources(sharedPrefence, getAssets(), super.getResources().getDisplayMetrics(), super.getResources().getConfiguration());
}

custom Resources class cannot be used in this way in androidX, by removing this method from Baseactivity.java solved the problem, thanks for all your suppor



来源:https://stackoverflow.com/questions/58965782/classnotfoundexception-config-inputeventcompatprocessoroverrideclassname-androi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!