سؤال

I have used this workaround provided here, which enables the app to open the navigation drawer whenever the user sides (to the right) anywhere on the screen. The code works absolutely fine.

However, I just signed my apk to be uploaded on the Play Store, and while testing, the slide to open failed to work. I did a little snooping to find out what the problem was, and found out that it was throwing a NoSuchFieldException for Field leftDraggerField = drawerLayout.getClass().getDeclaredField("mLeftDragger");

I have no idea why it doesn't work. It works great with the debug apk, but not with the signed apk. Could anyone please help me understand the problem?

هل كانت مفيدة؟

المحلول

Oh well, it was a nightmare when I first encountered this problem. It took me a couple of hours to figure out what was going wrong. The problem was that I had enabled ProGuard and the member field mLeftDragger was obfuscated. I had to tell ProGuard not to obfuscate any of the class members of DrawerLayout, which belonged to the package android.support.v4.widget

I added the following in proguard-project.txt

-keepclasseswithmembernames class android.support.v4.widget.** { *; }

and everything was working like charm as before.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top