1

I'm getting a message in my logcat stating:

Failed resolving interface 26 Landroid/content/ClipboardManager$OnPrimaryClipChangedListener;'

but I have no idea what might be causing it - or what I might be able to do about it. Has anyone seen this before? Stackoverflow and google searches aren't coming up with any relevant information.

P.S.

This may be related to another issue I'm having but I'm not sure:

InsertAPN() Method Does Not Write APN Settings - Android 2.3.6

Community
  • 1
  • 1

1 Answers1

0

You're getting this error because ClipboardManager was introduced in API level 11, while you're running the app on API level 10.

When you're using code that was introduced in API levels greater than your declared minSDK version make sure you're checking on what platform you're actually running. Guard the API that the running device cannot support, as per below sample code:

public void myMagicCode() {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        methodThatUsesClipboardManager();
    }
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void methodThatUsesClipboardManager() {
    ClipboardManager instance = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
    //use the instance
}
Community
  • 1
  • 1
gunar
  • 14,660
  • 7
  • 56
  • 87
  • Ok. I need to use Gingerbread devices so I'll need to figure out a workaround. So... in your eyes - the two issues are unrelated - correct? – OverflowCustodian Sep 04 '13 at 20:32
  • The other question calls `tm.getSimOperator()`. I am not sure from where that is, I am not sure if they're related or not. At least you can fix this issue and check if it helps in the other place. I can see in the logs there is a `dead code` warning just after this code fails to execute, so they might be related. – gunar Sep 04 '13 at 20:38
  • Yes... thank you! (I'm still stuck on the other half of the issue - but I appreciate the help!) http://stackoverflow.com/questions/18638705/contentresolver-cursor-does-not-write-apn-settings – OverflowCustodian Sep 05 '13 at 15:18