When I execute a code referencing the https://developer.android.com/reference/android/telephony/TelephonyManager.CellInfoCallback on Android phones running Android P and lower I get the following message in the logs:
Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/telephony/TelephonyManager$CellInfoCallback;
I do not want this message to be spammed and visible to a customer. I've tried annotating the class using
@RequiresApi(api = Build.VERSION_CODES.Q)
class RadioCallback : TelephonyManager.CellInfoCallback() {
override fun onCellInfo(p0: MutableList<CellInfo>) {
}
}
and calls to this class are only made on Android Q:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val radioCallback = RadioCallback()
telephonyManager.requestCellInfoUpdate(AsyncTask.SERIAL_EXECUTOR, radioCallback)
}
P.S. solutions from this thread java.lang.NoClassDefFoundError on older Android SDK versions are not helpful