Android Question MaterialPreferences - java.lang.NoClassDefFoundError

gravel

Member
Licensed User
Longtime User
Working on an update for my app which uses the MaterialPreferences library, I'm getting this error when clicking a ListPreference.
Code: Copy
java.lang.NoClassDefFoundError: android.support.v7.widget.XpDropDownListView
    at android.support.v7.widget.AbstractXpListPopupWindow.createDropDownListView(AbstractXpListPopupWindow.java:1789)
    at android.support.v7.widget.AbstractXpListPopupWindow.buildDropDown(AbstractXpListPopupWindow.java:1604)
    at android.support.v7.widget.AbstractXpListPopupWindow.getPreferredVerticalOffset(AbstractXpListPopupWindow.java:1282)
    at net.xpece.android.support.preference.ListPreference.showAsPopup(ListPreference.java:196)
    at net.xpece.android.support.preference.ListPreference.performClick(ListPreference.java:130)
    at android.support.v7.preference.Preference$1.onClick(Preference.java:170)
    at android.view.View.performClick(View.java:5198)
    at android.view.View$PerformClick.run(View.java:21147)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
The .apk of the previous version (middle of Feb) works correctly, but compiling it again from source generates the error as well.

The Material Preferences example also generates the error. https://www.b4x.com/android/forum/threads/preferences-material-design-preferences.75482/#content

Only the ListPreference modes MENU_MODE_SIMPLE_ADAPTIVE and MENU_MODE_SIMPLE_MENU show a problem ... MENU_MODE_DIALOG, MENU_MODE_SIMPLE_DIALOG and everything else in the lib seems to work OK.

I've been updating 'recommended' in SDK manager and I'm assuming that it's as a result of an SDK update, but I don't know what or how. Any suggestions on what I can do to retrieve the situation?
 
Hmm,
The example code works perfectly fine here, make sure that you have updated your SDK and also make sure that you have the newest .jar files in your external library folder.
 
Upvote 0
Thanks Peter.

I re-downloaded the latest library files and moved them to additional libraries, they were the same.

Checked SDKManager again, everything recommended is installed.

But still the same error.

This is what SDKManager shows I have for android.support
sdk1.png
sdk2.png



Everything else in the app and Preferences example seems to be working properly. But something has changed since mid Feb when I did the previous version where the .apk works ... but what ... hmm?
 
Upvote 0
I have the same error.
UPD: error if the lisy is MENU_MODE_SIMPLE_MENU or MENU_MODE_SIMPLE_ADAPTIVE, other lists work OK.
 
Last edited:
Upvote 0
@gravel Do you still have the problem?

I just tested the example app. Only MENU_MODE_SIMPLE_ADAPTIVE ist not working and crashes with

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/ListViewCompat;

I think I will have to update the library. This will take some time since I have to recreate the library project for some other reasons.
 
Upvote 0
Upvote 0
He just forgot to add the folder into the new sample project zip, like in the prev sample.
 
Upvote 0
@corwin32 Without using your update the error I got just now was the same as you saw:
Code: Copy
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/ListViewCompat;
Using your updated lib all is now good. Thank you.
 
Upvote 0
Back
Top