'Java public field accessible in debugger but not in Kotlin code
Solution 1:[1]
if you look in the source you can see this:
/**
* The reported scaled density prior to any compatibility mode scaling
* being applied.
* @hide
*/
public float noncompatScaledDensity;
It's annotated with @hide which means the field is not technically part of the SDK. Google uses the @hide annotation to strip out the classes and methods they don't want to be part of the public SDK. That's why your IDE cannot compile your code against them -- they literally don't exist. However, the android framework jar on an actual device DOES contain these classes and methods, which is why they can be accessed at runtime using reflection.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ivo Beckers |


