应用程序仅在特定计算机上崩溃。出现 NoClassDefFoundError 错误

App Crashes only on particular computer. With NoClassDefFoundError error

我有一个应用程序。它在其他计算机上启动购买我的计算机没有。即使制作apk也不行。如果我从其他计算机创建同一个应用程序的 apk,它可以工作,如果我从这台计算机创建它,它就不会。它给了我以下错误

我试过: 1)清理重建 2) 失效并重启 3) 卸载/重新安装 Android studio 4) 从这里使用 multidex https://developer.android.com/studio/build/multidex 5) 尝试过原生模拟器/genymotion/真实设备

我已经尝试了所有(我认为)可能导致问题的方法。因此,如果想减去该问题,请发表评论有什么问题,这可以帮助我提高问题的质量。

java.lang.NoClassDefFoundError: android.support.graphics.drawable.VectorDrawableCompat
        at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:775)
        at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:366)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:198)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191)
        at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:753)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:196)
        at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:86)
        at android.support.v7.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:260)
        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:182)
        at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:520)
        at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
        at com.myApp.base.BaseActivity.onCreate(BaseActivity.java:69)
        at com.myApp.devicemanager.DMActivity.onCreate(DMActivity.java:29)
        at android.app.Activity.performCreate(Activity.java:5231)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
        at android.app.ActivityThread.access0(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)

Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.myApp.mobile.pm.payday"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation ("com.myApp.mobile.pm.common:app:$rootProject.ext.commonVersion") {
        exclude group: 'com.fasterxml.jackson.annotation'
        exclude group: 'com.fasterxml.jackson.core'
        exclude group: 'com.fasterxml.jackson.databind'
    }

    annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.ext.butterknifeVersion"
    annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"

}

根据您正在测试的 simulator/device 上 android 的版本,您可能需要将此行添加到您的 gradle

android {
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
 }

来源:Android Vector Drawable Documentations.