Skip to content Skip to sidebar Skip to footer

Reflection Not Working On Android Release Apk. Even With Proguard/minify Disabled

Currently I'm facing an odd issue that the release apk of my app throws NoSuchFieldExceptions. It works fine on a debug apk. The fields I am trying to get are android.widget packag

Solution 1:

An IllegalAccessException means it can see the variable/method, but that it can't access it because its private (or because its protected and this isn't the same package). This isn't a case of reflection not working, its a common bug that without reflection wouldn't compile.

You can change the visibility of the variable/method at runtime using reflection and then access it, but its not recommended. Its better to add a public method that does what you need, to prevent the possibility of changing data in ways the class wasn't written to accept.


Post a Comment for "Reflection Not Working On Android Release Apk. Even With Proguard/minify Disabled"