Skip to content Skip to sidebar Skip to footer

Cannot Override Java Function In Kotlin

I am currently developing a BLE-enabled Android app targeting API 27 using Kotlin. I am attempting to override a function within android.bluetooth.BluetoothGatt. There are a number

Solution 1:

You should not use this method, it is only for internal use and not part of the public API. Therefore it is hidden via @hide. For more information about @hide and how to access it regardless see What does @hide mean in the Android source code?

Note that using reflection to access it as described in the link above is discouraged

The method you want to use is on the dark-greylist with the following restrictions:

dark-greylist:

  • For apps whose target SDK is below API level 28: each use of a dark greylist interface is permitted.
  • apps whose target SDK is API level 28 or higher: same behavior as blacklist

blacklist: restricted regardless of target SDK. The platform will behave as if the interface is absent. For example, it will throw NoSuchMethodError/NoSuchFieldException whenever the app is trying to use it, and will not include it when the app wants to know the list of fields/methods of a particular class.

Post a Comment for "Cannot Override Java Function In Kotlin"