NoClassDefFoundError: android.support.design.internal.NavigationMenu on Android 4.2.2 (wiko)

前端 未结 5 1518
逝去的感伤
逝去的感伤 2021-01-04 18:25

I am trying to use the Android Support Design library (in version 23.0.1) and the class NavigationMenu (I use this class as an XML tag into a layout).

W

5条回答
  •  萌比男神i
    2021-01-04 19:13

    I'm following similar thread and struggling with finding the solution, but I don't have a device.

    Basing on people's comments I have added following to the proguard config build type:

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
        }
    }
    

    proguard-project.txt

    -repackageclasses ''
    -keep class android.support.v4.app.** { *; }
    -keep interface android.support.v4.app.** { *; }
    
    -keep class android.support.v7.app.** { *; }
    -keep interface android.support.v7.app.** { *; }
    
    -keep class android.support.v13.app.** { *; }
    -keep interface android.support.v13.app.** { *; }
    

    Could you please try with the following config? I have some doubts to this solution, because when I have undexed produced classes I still had NavigationMenuView in the same package. It hasn't been moved because of it's package access relationships. So what may help is adding another flag to the proguard-project.txt config, quite risky though:

    -allowaccessmodification
    

    That may be a good start to try fixing the issue.

    So in your case proguard-project should look like this:

    -keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
    
    -dontobfuscate
    -dontoptimize
    -allowaccessmodification
    -repackageclasses ''
    -keep class your.package.name.** { *; }
    -keep class android.support.v4.app.** { *; }
    -keep interface android.support.v4.app.** { *; }
    
    -keep class android.support.v7.app.** { *; }
    -keep interface android.support.v7.app.** { *; }
    
    -keep class android.support.v13.app.** { *; }
    -keep interface android.support.v13.app.** { *; }
    

提交回复
热议问题