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

前端 未结 5 1483
逝去的感伤
逝去的感伤 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条回答
  • 2021-01-04 18:49

    I'm going with this. I haven't tried it yet, since I don't have any of the affected devices:

    -keep class !android.support.design.internal.NavigationMenu,!android.support.design.internal.NavigationMenuPresenter,!android.support.design.internal.NavigationSubMenu
    

    That goes in addition to this rule that helps many Samsung devices (see http://goo.gl/ywG1c4):

    -keep class !android.support.v7.view.menu.**,android.support.** {*;}
    
    0 讨论(0)
  • 2021-01-04 18:57

    Check com.android.support:appcompat version. For example, instead of com.android.support:appcompat-v7:23.1.1 try to use com.android.support:appcompat-v7:23.0.1

    0 讨论(0)
  • 2021-01-04 19:03

    -

       -keep class !android.support.v7.internal.view.menu.**,** {*;}
       -keep class android.support.v4.** { *; }
       -keep interface android.support.v4.** { *; }
       -keep class android.support.v7.** { *; }
       -keep interface android.support.v7.** { *; }
    
    0 讨论(0)
  • 2021-01-04 19:12

    Thx for Szymon Klimaszewski for the help ! Here the proguard file that works for me :

    -keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
    
    -dontobfuscate
    -dontoptimize
    -repackageclasses ''
    
    #Jackson
    -dontwarn com.fasterxml.jackson.databind.**
    
    #View Pager Indicator
    -dontwarn com.viewpagerindicator.**
    
    #Android
    -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.** { *; }
    
    #droid4me
    -keep class com.smartnsoft.** { *; }
    
    #my app
    -keep class my.app.package.** { *; }
    
    #Critercism
    -keep public class com.crittercism.**
    -keepclassmembers public class com.crittercism.* { *; }
    
    0 讨论(0)
  • 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.** { *; }
    
    0 讨论(0)
提交回复
热议问题