Sunday, February 15, 2015

Andorid Error : java.lang.NoSuchMethodError: android.View.getMinimumHeight

So I got reports of the error from my Play Store for my app Message Counter.

java.lang.NoSuchMethodError: android.View.getMinimumHeight

In the new build, I had implemented a custom view that reads the min width and height from the xml declaration. The app was working on all the devices that I test. However I did notice that the reports were made from Android devices Version 4.0 or below. Further digging and I found the below solution.

getMinimumHeight() is available in API 16+. 
Use android.View.getSuggestedMinimumHeight() instead

It appears that ImageView.getMaxHeight() is also API 16+. Sadly I could not find any alternatives for this one.

Message Counter on Google Play