I think this is an error in the SearchView.java class in the support library, you can see that it uses View.OnLayoutChangeListener in the general implementation file:
https://android.googlesource.com/platform/frameworks/support.git/+/android-4.3_r1/v7/appcompat/src/android/support/v7/widget/SearchView.java
this makes the classloader try loading the View.OnLayoutChangeListener, which is available from api level 11, even if this * SDK11 method is not even called. I believe that this addOnLayoutChangeListenerToDropDownAnchorSDK11 method should be moved to an external java class and only used if the device API is>> 11.
You can reproduce this error by copying this code into your own activity:
private void addOnLayoutChangeListenerToDropDownAnchorSDK11() { new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { } }; } public void onCreate(...) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { addOnLayoutChangeListenerToDropDownAnchorSDK11(); } }
below is what logcat prints:
08-31 22:50:33.030: INFO/dalvikvm(20753): Failed resolving Lcom/example/ActionBarTester/MyActivity$1; interface 813 'Landroid/view/View$OnLayoutChangeListener;' 08-31 22:50:33.030: WARN/dalvikvm(20753): Link of class 'Lcom/example/ActionBarTester/MyActivity$1;' failed 08-31 22:50:33.030: ERROR/dalvikvm(20753): Could not find class 'com.example.ActionBarTester.MyActivity$1', referenced from method com.example.ActionBarTester.MyActivity.addOnLayoutChangeListenerToDropDownAnchorSDK11 08-31 22:50:33.030: WARN/dalvikvm(20753): VFY: unable to resolve new-instance 903 (Lcom/example/ActionBarTester/MyActivity$1;) in Lcom/example/ActionBarTester/MyActivity; 08-31 22:50:33.030: DEBUG/dalvikvm(20753): VFY: replacing opcode 0x22 at 0x0000 08-31 22:50:33.030: DEBUG/dalvikvm(20753): VFY: dead code 0x0002-0005 in Lcom/example/ActionBarTester/MyActivity;.addOnLayoutChangeListenerToDropDownAnchorSDK11 ()V
I'm not sure if this error actually causes any problems, in my case SearchView works at API level 10, and the tests above allow my activity to work. Maybe something is missing me.
source share