致命异常不兼容类更改错误 | 绘图仪崩溃

Mar*_*lal 5 android exception draw kotlin android-jetpack-compose

我收到了这个 crashlytics 崩溃事件,特别是通过亚马逊设备。

致命异常:java.lang.InknownClassChangeError 找到接口 androidx.compose.ui.graphics.drawscope.DrawScope,但需要类('androidx.compose.ui.graphics.drawscope.DrawScope' 的声明出现在 /data/app/~ ~dI2D-_x33YVzjrNGowkPgw==/com.m128kb.~~~~~-WnvHnaVmpCa58IEaXGiQAw==/base.apk)

我正在使用最新版本的 Android Studio,并且尝试了许多不同的 JDK 版本,但它对我不起作用。任何帮助人员

构建.gradle项目

buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.3.14'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
        classpath 'com.google.firebase:perf-plugin:1.4.2'
    }
    repositories {
        google()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    }

}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.3.1' apply false
    id 'com.android.library' version '7.3.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}


task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

构建.gradle应用程序

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-parcelize'
    id 'com.google.gms.google-services'
    id 'com.google.firebase.crashlytics'
    id 'com.google.firebase.firebase-perf'
}

android {

    compileSdk 33

    defaultConfig {
        applicationId "com.m128kb."
        minSdk 24
        targetSdk 33
        versionCode 19
        versionName "4.0.2"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }

    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility "1.8"
        targetCompatibility "1.8"
    }
    kotlinOptions {

        freeCompilerArgs = ['-Xjvm-default=all-compatibility']
        jvmTarget = "1.8"

    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.3.2"
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
    namespace 'com.m128kb.'


}

dependencies {

    def composeBom = platform('androidx.compose:compose-bom:2022.12.00')
    implementation composeBom
    androidTestImplementation composeBom

    implementation 'androidx.compose.material:material'
    implementation 'androidx.compose.ui:ui'
    //LiveData
    implementation 'androidx.compose.runtime:runtime-livedata'
    // Android Studio Preview support
    implementation 'androidx.compose.ui:ui-tooling-preview'
    debugImplementation 'androidx.compose.ui:ui-tooling'
    //Icon
    implementation 'androidx.compose.material:material-icons-extended'
    //Fonts
    implementation 'androidx.compose.ui:ui-text-google-fonts'


    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
    implementation 'androidx.activity:activity-compose:1.6.1'
    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'
    implementation 'com.google.android.gms:play-services-ads:21.4.0'


    // UI Tests
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
    debugImplementation 'androidx.compose.ui:ui-test-manifest'
    //Testing
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'


    //Coroutine
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'

    //Coil
    implementation "io.coil-kt:coil-compose:2.2.2"


    def nav_version = "2.5.3"
    implementation "androidx.navigation:navigation-compose:$nav_version"

    implementation 'com.google.accompanist:accompanist-navigation-animation:0.28.0'

    //Firebase
    implementation platform('com.google.firebase:firebase-bom:31.1.1')
    implementation 'com.google.firebase:firebase-firestore-ktx'
    implementation 'com.google.firebase:firebase-storage-ktx'
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-messaging-ktx'
    implementation 'com.google.firebase:firebase-inappmessaging-display-ktx'
    implementation 'com.google.firebase:firebase-perf-ktx'


    implementation("com.google.accompanist:accompanist-systemuicontroller:0.28.0")


    def lifecycle_version = "2.2.0"
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
    annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

    //ViewModel
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1")
    implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1")

    //Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

    // define a BOM and its version
    implementation(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))
    // define any required OkHttp artifacts without version
    implementation("com.squareup.okhttp3:okhttp")
    implementation("com.squareup.okhttp3:logging-interceptor")

    //lottie
    def lottieVersion = "5.2.0"
    implementation "com.airbnb.android:lottie-compose:$lottieVersion"


}
Run Code Online (Sandbox Code Playgroud)

Sim*_*Off 0

我也遇到了同样的问题,事实证明我们的问题出在我们的插件上,但具体来说是我们列表中的Applovin Quality Service版本。com.applovin.quality:AppLovinQualityServiceGradlePlugindependencies

首先我们删除了该插件,然后向 Applovin 提出了一个问题: https: //github.com/AppLovin/AppLovin-MAX-Ad-Review-SDK-Android/issues/1

提出问题后,我意识到我们的插件版本已过时,并从版本升级4.3.7到最新版本4.9.3,问题由此解决。

我知道您没有在这里使用该插件(从您的 gradle 文件的外观来看),但我会尝试更新您必须查看的所有依赖项和插件,看看它是否可以解决问题。

在此发布此内容以防其他人遇到同样的问题。