我正在尝试将颜色选择器添加到我的android项目中作为库,但每次我构建我的apk并想要进入我的首选项屏幕时应用程序崩溃与以下logcat:
03-06 19:01:47.215: E/AndroidRuntime(23153): FATAL EXCEPTION: main
03-06 19:01:47.215: E/AndroidRuntime(23153): Process: com.lwptest.lwp, PID: 23153
03-06 19:01:47.215: E/AndroidRuntime(23153): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lwptest.lwp/com.lwptest.lwp.myProductSettings}: android.view.InflateException: Binary XML file line #18: Error inflating class net.margaritov.preference.colorpicker.ColorPickerPreference
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.ActivityThread.access$800(ActivityThread.java:144)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.os.Handler.dispatchMessage(Handler.java:102)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.os.Looper.loop(Looper.java:135)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.ActivityThread.main(ActivityThread.java:5221)
03-06 19:01:47.215: E/AndroidRuntime(23153): at java.lang.reflect.Method.invoke(Native Method)
03-06 19:01:47.215: E/AndroidRuntime(23153): at java.lang.reflect.Method.invoke(Method.java:372)
03-06 19:01:47.215: E/AndroidRuntime(23153): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
03-06 19:01:47.215: E/AndroidRuntime(23153): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
03-06 19:01:47.215: E/AndroidRuntime(23153): Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class net.margaritov.preference.colorpicker.ColorPickerPreference
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:441)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.preference.GenericInflater.inflate(GenericInflater.java:326)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.preference.GenericInflater.inflate(GenericInflater.java:263)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.preference.PreferenceFragment.addPreferencesFromResource(PreferenceFragment.java:299)
03-06 19:01:47.215: E/AndroidRuntime(23153): at com.lwptest.lwp.myProductSettings$PrefsFragment.onCreate(myProductSettings.java:115)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.Fragment.performCreate(Fragment.java:2031)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:863)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.BackStackRecord.run(BackStackRecord.java:833)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.Activity.performStart(Activity.java:5948)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
03-06 19:01:47.215: E/AndroidRuntime(23153): ... 10 more
03-06 19:01:47.215: E/AndroidRuntime(23153): Caused by: java.lang.ClassNotFoundException: Didn't find class "net.margaritov.preference.colorpicker.ColorPickerPreference" on path: DexPathList[[zip file "/data/app/com.lwptest.lwp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.lwptest.lwp-2/lib/arm, /vendor/lib, /system/lib]]
03-06 19:01:47.215: E/AndroidRuntime(23153): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-06 19:01:47.215: E/AndroidRuntime(23153): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-06 19:01:47.215: E/AndroidRuntime(23153): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.preference.GenericInflater.createItem(GenericInflater.java:375)
03-06 19:01:47.215: E/AndroidRuntime(23153): at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:430)
03-06 19:01:47.215: E/AndroidRuntime(23153): ... 24 more
03-06 19:01:47.215: E/AndroidRuntime(23153): Suppressed: java.lang.ClassNotFoundException: net.margaritov.preference.colorpicker.ColorPickerPreference
03-06 19:01:47.215: E/AndroidRuntime(23153): at java.lang.Class.classForName(Native Method)
03-06 19:01:47.215: E/AndroidRuntime(23153): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
03-06 19:01:47.215: E/AndroidRuntime(23153): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
03-06 19:01:47.215: E/AndroidRuntime(23153): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
03-06 19:01:47.215: E/AndroidRuntime(23153): ... 27 more
03-06 19:01:47.215: E/AndroidRuntime(23153): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
颜色选择器已经在之前实现了,但是我丢失了我的工作区并且不得不从备份重建我的项目,所以我们在这里。 我不知道该怎么做了......这个库作为现有的android项目被导入工作区。我将它标记为一个库,并将其设置在我自己项目的库下。 我甚至试图将另一个颜色选择器添加为库以确保 - >我得到了同样的错误(当然有不同的包名)。
因此将库导入我的项目时会出现问题......我缺少什么? 我在这一点上绝对无能为力,我们非常感谢任何帮助!
编辑:我也试过"项目 - 清洁"几次;没有帮助。