代码之家  ›  专栏  ›  技术社区  ›  malhobayyeb

Android类NotFoundException Android.support.v4.util.ArrayMap

  •  0
  • malhobayyeb  · 技术社区  · 6 年前

    我已经按照以下官方网页中的文档将我的Android支持库依赖项迁移到AndroidX:

    https://developer.android.com/jetpack/androidx/migrate

    迁移后,出现以下错误:

    java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
    ...
    ...
    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap"
    

    apply plugin: 'com.android.application'
    
    apply plugin: 'kotlin-android'
    
    apply plugin: 'kotlin-android-extensions'
    
    android {
        compileSdkVersion 28
    
        defaultConfig {
            applicationId "app.app.app.app"
    
            minSdkVersion 26
            targetSdkVersion 28
    
            versionCode 1
            versionName "1.0"
        }
    
        buildTypes {
            release {
                minifyEnabled false
    
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
    
        // Kotlin
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.10'
    
        // Support
        implementation 'androidx.appcompat:appcompat:1.0.2'
        implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0'
        implementation 'androidx.media:media:1.0.0'
        implementation 'androidx.legacy:legacy-support-v4:1.0.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    
        // Firebase
        implementation('com.google.firebase:firebase-firestore:17.1.3') {
            exclude group: 'com.android.support', module: 'support-v4'
        }
    
        // Misc
        implementation 'com.budiyev.android:code-scanner:2.0.0'
        implementation 'com.google.code.gson:gson:2.8.5'
        implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
    }
    
    apply plugin: 'com.google.gms.google-services'
    

    请注意,我有以下几行:

    exclude group: 'com.android.support', module: 'support-v4'
    

    如果删除,我将有其他问题:

    Program type already present: android.support.v4.*.*
    

    我已经开始(*)包和类在每次编译时都会更改:

    Program type already present: android.support.v4.app.INotificationSideChannel
    
    Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver
    
    0 回复  |  直到 6 年前
    推荐文章