3

Typeface class contains a static findFromCache method: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/graphics/java/android/graphics/Typeface.java

I also see the method in IntelliJ in Typeface source code.

However, when I try to use it I get Unresolved reference: findFromCache error. My current API version is 28. Target API 26.

Why does it show an error when the method is present in the SDK?

Ivan Nikitin
  • 3,578
  • 27
  • 39
  • I checked the documentation from developer website and there is no method present that you have named. check here https://developer.android.com/reference/android/graphics/Typeface – karan Dec 10 '18 at 09:59
  • @KaranMer I know. However, it's there in the sources and IntelliJ shows the method in SDK as well. It's public. – Ivan Nikitin Dec 10 '18 at 10:29
  • I checked in android studio for api 28 and its not here as well. – karan Dec 10 '18 at 10:34
  • however it is there in api 27 sources. – karan Dec 10 '18 at 10:38
  • This is bug in android studio. i submitted bug on this and google team mention that they will fix this bug in next release. – Nikul Vadher Dec 18 '18 at 07:51

1 Answers1

2

This API has an "annotation" @hide, this means it is an undocumented / hidden API, which are prohibited to use since Android API 28.

Geno Chen
  • 4,916
  • 6
  • 21
  • 39
  • Some related news, discussions can be searched with keyword "android api 28 hide", for example [in XDA](https://www.xda-developers.com/google-undocumented-hidden-apis-android-p/), or [in CommonsWare](https://commonsware.com/blog/2018/01/18/think-hard-about-hide.html). – Geno Chen Dec 10 '18 at 11:54