1

I'm making the transfer to Android Studio 1.0.1. I've also been avoiding using the android-support-v7 due to the problem that I'm encountering described in this link. However now I want to include material design and need to use the appcompat.

The two devices I test on are affected by the bug in the link above, so I have a few ideas of how to solve this. Please give me advice on if these will work, because I'm not familiar with how Proguard works yet due to never having used it (I've read through the documentation)

I believe I just need to include these lines to make appcompat libraries work on the affected Samsung devices:

# Allow obfuscation of android.support.v7.internal.view.menu.**
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
# see https://code.google.com/p/android/issues/detail?id=78377
-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}

1) in the buildTypes create a "debug" section. Set minifyEnabled to "true" and only include the file with the lines specified in the link above in the proguard file specified. Don't include the default proguard file because while debugging I don't want all of the code to be minimized, I just want to rename the affected classes.

I guess I only have one idea. Will this work? I'm going to try it and report back...

Community
  • 1
  • 1
Tom McFarlin
  • 829
  • 1
  • 9
  • 24

1 Answers1

0

If you are debugging on samsung devices running 4.2.2 and are having issues, ensure you add the following lines of code to the 'proguard-android.txt' if you are using proguard, or create your own text file (as I did) and point to that file in your build.gradle

# Allow obfuscation of android.support.v7.internal.view.menu.**
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
# see https://code.google.com/p/android/issues/detail?id=78377
-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}

Here's what my gradle file looks like. 'samsung-alteration.txt' contains only the above code snippet

buildTypes {
    debug {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('samsung-alteration.txt')
    }

    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

Hope this helps some of yinz!

Tom McFarlin
  • 829
  • 1
  • 9
  • 24