Question

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

Was it helpful?

Solution

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
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top