I have a class that extends android.support.v4.PreferenceFragment
. When I run the app I first get this warning on LogCat:
04-02 14:22:57.113: W/dalvikvm(28828): VFY: unable to resolve static field 656 (preference_list_fragment) in Landroid/support/v4/preferencefragment/R$layout;
Then upon tapping an option on the app's UI, it shuts down and this error appears on LogCat
04-02 14:22:57.158: E/AndroidRuntime(28828): FATAL EXCEPTION: main
04-02 14:22:57.158: E/AndroidRuntime(28828): java.lang.NoClassDefFoundError: android.support.v4.preferencefragment.R$layout
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.support.v4.preference.PreferenceFragment.onCreateView(PreferenceFragment.java:95)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.os.Handler.handleCallback(Handler.java:725)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.os.Handler.dispatchMessage(Handler.java:92)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.os.Looper.loop(Looper.java:137)
04-02 14:22:57.158: E/AndroidRuntime(28828): at android.app.ActivityThread.main(ActivityThread.java:5039)
04-02 14:22:57.158: E/AndroidRuntime(28828): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 14:22:57.158: E/AndroidRuntime(28828): at java.lang.reflect.Method.invoke(Method.java:511)
04-02 14:22:57.158: E/AndroidRuntime(28828): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-02 14:22:57.158: E/AndroidRuntime(28828): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-02 14:22:57.158: E/AndroidRuntime(28828): at dalvik.system.NativeStart.main(Native Method)
I have gone through many posts about the same problem, and I did all of the following already:
PreferenceFragment
from https://github.com/kolavar/android-support-v4-preferencefragment , imported it as a project, and added it as a required project to my buildpath. android-support-v4.jar
in the libs
folder, and added it to my build path android-support-v4-preferencefragment-master.jar
in the libs
folder, and added it to my build path Android Support Library
and Android Support Repository
from the Android SDK Manager. But still the problem persists.
I am testing on a nexus 10
Generally speaking, never mess with the build path manually.
The project you are trying to use is an Android library project. There are instructions for adding a dependency on an Android library project to your Eclipse project . Given that you have imported it into your Eclipse workspace, you need to add it as a dependency via the Android portion of your project settings:
Click the Add button, choose this library project from the dialog, click OK to close up each dialog, and you should be set.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.