ButterKnife R2生成的文件未在我的项目中显示

时间:2019-05-01 12:27:53

标签: android butterknife

我有一个使用ButterKnife进行绑定的库,据我了解,资源将在R2生成的文件中

该应用程序已编译并运行,但是当我尝试使用库中的视图时出现异常

这是个例外

android.view.InflateException: Binary XML file line #15: Binary XML file line #15: Error inflating class im.vector.view.HomeSectionView
    Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class im.vector.view.HomeSectionView
    Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
        at android.view.LayoutInflater.createView(LayoutInflater.java:652)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
        at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126)
        at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:95)
        at com.sbs16.ensofia.base.BaseFragment.onCreateView(BaseFragment.kt:28)
        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2439)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
        at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:802)
        at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
        at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
        at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
        at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
        at androidx.fragment.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6682)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
     Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f0e00b0
        at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:202)
        at android.content.res.Resources.loadXmlResourceParser(Resources.java:2968)
        at android.content.res.Resources.getLayout(Resources.java:1984)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:425)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
        at android.view.View.inflate(View.java:22188)
        at im.vector.view.HomeSectionView.setup(HomeSectionView.java:109)
        at im.vector.view.HomeSectionView.<init>(HomeSectionView.java:79)

这是我的代码

<im.vector.view.HomeSectionView
                    android:id="@+id/invitations_section"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>

在库中找到HomeSectionView并使用R2文件中的资源

有人在之前遇到过同样的问题吗?

0 个答案:

没有答案