0
votes

I just got a NoClassDefFoundError when testing an Android app I'm building on a Device running API level 28. When I checked the documentation the method causing the crash was introduced in API level 29. As I have targeted the app for API level 18 I am used to be shown Call requires API level X (current min is 18) lints inside Android Studio when using newer API calls. But in this case there was nothing. Why is that?

Code snippet:

TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
//Gives expected lint error notification: Call requires API level 28 (current min is 18)
tm.getSignalStrength();
//No lint error whatsoever (API Level 29 needed)
tm.requestCellInfoUpdate(null, null);
    
1

1 Answers

0
votes

It is hard to say why the lint is not showing the error. This might happen in different scenarios.

  1. You might have suppressed the lint for this line in Android Studio.
  2. You might have suppressed the lint for this code segment.
  3. Your code might not have indexed properly and hence it cannot show potential runtime errors.

Whatever the reason is, you can always find the warnings and lint errors by running Analyze -> Inspect code.