2014-05-21 33 views
1

大家好,我目前遇到一個錯誤,讓我有點困惑。我正在使用Derek Brameyer使用BetterPickers Library的項目。使用庫項目和android.view.InflateException二進制XML文件行#7錯誤膨脹類

應用崩潰試圖構造這個選擇器選擇對象時(主要是看中的DateTimePicker),因爲由於以下錯誤

android.view.InflateException: Binary XML file line #7: Error inflating class com.doomonafireball.betterpickers.expirationpicker.ExpirationPicker 

我不知道很多關於什麼原因導致這種例外,我認爲這可能不是庫本身內的實現問題

這裏是logcat,它是相當長的,但最初的錯誤可能是重要的一個。我並不想只是粘貼一串代碼

Process: com.rrturnjump.spolfoil, PID: 22599 
    android.view.InflateException: Binary XML file line #7: Error inflating class com.doomonafireball.betterpickers.expirationpicker.ExpirationPicker 
      at android.view.LayoutInflater.createView(LayoutInflater.java:620) 
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
      at com.doomonafireball.betterpickers.expirationpicker.ExpirationPickerDialogFragment.onCreateView(ExpirationPickerDialogFragment.java:117) 
      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927) 
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) 
      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 
      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467) 
      at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440) 
      at android.os.Handler.handleCallback(Handler.java:733) 
      at android.os.Handler.dispatchMessage(Handler.java:95) 
      at android.os.Looper.loop(Looper.java:136) 
      at android.app.ActivityThread.main(ActivityThread.java:5017) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:515) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
      at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.reflect.InvocationTargetException 
      at java.lang.reflect.Constructor.constructNative(Native Method) 
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
      at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
            at com.doomonafireball.betterpickers.expirationpicker.ExpirationPickerDialogFragment.onCreateView(ExpirationPickerDialogFragment.java:117) 
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927) 
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) 
            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 
            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467) 
            at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440) 
            at android.os.Handler.handleCallback(Handler.java:733) 
            at android.os.Handler.dispatchMessage(Handler.java:95) 
            at android.os.Looper.loop(Looper.java:136) 
            at android.app.ActivityThread.main(ActivityThread.java:5017) 
            at java.lang.reflect.Method.invokeNative(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:515) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
            at dalvik.system.NativeStart.main(Native Method) 
    Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.doomonafireball.betterpickers.expirationpicker.ExpirationView 
      at android.view.LayoutInflater.createView(LayoutInflater.java:620) 
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
      at com.doomonafireball.betterpickers.expirationpicker.ExpirationPicker.<init>(ExpirationPicker.java:92) 
            at java.lang.reflect.Constructor.constructNative(Native Method) 
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
            at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
            at com.doomonafireball.betterpickers.expirationpicker.ExpirationPickerDialogFragment.onCreateView(ExpirationPickerDialogFragment.java:117) 
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927) 
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) 
            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 
            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467) 
            at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440) 
            at android.os.Handler.handleCallback(Handler.java:733) 
            at android.os.Handler.dispatchMessage(Handler.java:95) 
            at android.os.Looper.loop(Looper.java:136) 
            at android.app.ActivityThread.main(ActivityThread.java:5017) 
            at java.lang.reflect.Method.invokeNative(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:515) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
            at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.reflect.InvocationTargetException 
      at java.lang.reflect.Constructor.constructNative(Native Method) 
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
      at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
            at com.doomonafireball.betterpickers.expirationpicker.ExpirationPicker.<init>(ExpirationPicker.java:92) 
            at java.lang.reflect.Constructor.constructNative(Native Method) 
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
            at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
            at com.doomonafireball.betterpickers.expirationpicker.ExpirationPickerDialogFragment.onCreateView(ExpirationPickerDialogFragment.java:117) 
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927) 
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) 
            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 
            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467) 
            at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440) 
            at android.os.Handler.handleCallback(Handler.java:733) 
            at android.os.Handler.dispatchMessage(Handler.java:95) 
            at android.os.Looper.loop(Looper.java:136) 
            at android.app.ActivityThread.main(ActivityThread.java:5017) 
            at java.lang.reflect.Method.invokeNative(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:515) 
            aaaaand some other stuff 

,我相信它正試圖誇大,但有麻煩的佈局expiration_picker_dialog.xml,這是不是我設置了,所以我不相信問題在那裏。 Here is the src code for the layout, on GitHub

我在我的主要活動構造ExpirationPickerBuilder像這樣,根據使用指南

int resID = com.doomonafireball.betterpickers.R.style.medium_light_expiration; 

       ExpirationPickerBuilder dpb = new ExpirationPickerBuilder() 
         .setFragmentManager(getSupportFragmentManager()) 
         .setStyleResId(resID); 
       dpb.show(); 

這個錯誤已經快把我逼瘋了,如果有人甚至能告訴我如何解釋logcat的錯誤正確的,所以也許我可以弄清楚什麼是錯的,那很好!這裏是expirationpicker package src code如果可能提供一些洞察

回答

0

經過幾個小時的谷歌搜索和嘗試後,我找到了答案。由於Eclipse,錯誤顯示,你做的一切都是正確的。

現在您必須將資產文件夾的內容複製到應用程序的資產文件夾,一切都會好的。

如果您想閱讀原文,請選擇THIS

+0

希望這不是太晚。 ;) –

+0

是的,我已經切換到Android Studio! – Kelsey

1

最可能的答案是,你是從庫中膨脹的視圖,但在Java中,你的進口是從默認日期選擇器。請檢查您的進口並確認它們來自圖書館。

相關問題