I am trying to use the Support v7 PreferenceFragmentCompat
, but when I launch the app I get this VerifyError
at the creation of its object instance:
E/AndroidRuntime(21575): java.lang.VerifyError: android/support/v7/preference/PreferenceFragmentCompat
The code I am trying to use is as simple as this:
new PreferenceFragmentCompat() {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
}
};
This only happens with PreferenceFragmentCompat
, (for example I got no problems with this: new android.support.v7.preference.EditTextPreference();
).
Before using the support library everything was working fine with the android API PreferenceFragment
.
The support library are linked properly into the project (I am using also support Fragment and Toolbar with no problems at all).
At this point I am completely stuck and I really have no idea where to look for.
I did some deeper debug and I found out that despite the VerifyError stack trace does not indicate really anything in the Logcat, there is some information for this error stepping through the error classes in the debug, which is:
Didn't find class "android.support.v7.widget.RecyclerView" on path: DexPathList[[zip file "/data/app/com.myapp-59.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapp-59, /vendor/lib, /system/lib]]
In the API support v7, which I am using, this class is in its own sublibrary named recyclerview, which I forgot to include in the project (currently I am using the appcompat and the preference). The compiler doesn't see this, not sure why.