Android无法充气Cardview InflateException:二进制XML文件行#36:错误导致类<unknown>

时间:2017-04-06 22:50:23

标签: android xml android-gradle build.gradle android-support-library

我正在使用另一个我从github克隆的项目作为我主项目中的库。在我尝试点击试图充气卡片视图的可扩展视图之前,一切似乎都能正常工作。

logcat的:

android.view.InflateException: Binary XML file line #36: Binary XML file line #36: Error inflating class <unknown>
                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                          at com.philliphsu.clock2.list.BaseViewHolder.<init>(BaseViewHolder.java:47)
                                                                          at com.philliphsu.clock2.alarms.ui.BaseAlarmViewHolder.<init>(BaseAlarmViewHolder.java:0)
                                                                          at com.philliphsu.clock2.alarms.ui.ExpandedAlarmViewHolder.<init>(ExpandedAlarmViewHolder.java:0)
                                                                          at com.philliphsu.clock2.alarms.ui.AlarmsCursorAdapter.onCreateViewHolder(AlarmsCursorAdapter.java:55)
                                                                          at com.philliphsu.clock2.alarms.ui.AlarmsCursorAdapter.onCreateViewHolder(AlarmsCursorAdapter.java:34)
                                                                          at com.philliphsu.clock2.list.BaseCursorAdapter.onCreateViewHolder(BaseCursorAdapter.java:62)
                                                                          at com.philliphsu.clock2.list.BaseCursorAdapter.onCreateViewHolder(BaseCursorAdapter.java:32)
                                                                          at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6319)
                                                                          at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5507)
                                                                          at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5392)
                                                                          at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5388)
                                                                          at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2149)
                                                                          at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1533)
                                                                          at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1496)
                                                                          at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:593)
                                                                          at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3535)
                                                                          at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3264)
                                                                          at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3796)
                                                                          at android.view.View.layout(View.java:16639)
                                                                          at android.view.ViewGroup.layout(ViewGroup.java:5437)
                                                                          at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
                                                                          at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
                                                                          at android.view.View.layout(View.java:16639)
                                                                          at android.view.ViewGroup.layout(ViewGroup.java:5437)
                                                                          at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1795)
                                                                          at android.view.View.layout(View.java:16639)
                                                                          at android.view.ViewGroup.layout(ViewGroup.java:5437)
                                                                          at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:131)
                                                                          at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
                                                                          at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1375)
                                                                          at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:870)
                                                                          at android.view.View.layout(View.java:16639)
                                                                          at android.view.ViewGroup.layout(ViewGroup.java:5437)
                                                                          at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
                                                                          at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
                                                                          at android.view.View.layout(View.java:16639)
                                                                          at android.view.ViewGroup.layout(ViewGroup.java:5437)
                                                                          at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735)
                                                                          at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579)
                                                                          at android.widget.LinearLayout.onLayout(LinearLayout.java:1488)
                                                                          at android.view.View.layout(View.java:16639)
                                                                          at android.view.ViewGroup.layout(ViewGroup.java:5437)
                                                                          at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
                                                                          at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
                                                                          at android.view.View.layout(View.java:16639)
                                                                          at android.view.ViewGroup.layout(ViewGroup.java:5437)
                                                                          at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735)
                                                                        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:157

这是应用崩溃的我的.xml文件: enter image description here

这是我在该库上的build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.butterknife'

android {

    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {

        minSdkVersion 19
        targetSdkVersion 25
        versionCode 113
        versionName "1.1.3"
        // Disabled for now because we're not ready to
        // completely port over to vector drawables
        vectorDrawables.useSupportLibrary = true

    }
    buildTypes {
        release {
            // https://developer.android.com/studio/build/shrink-code.html#shrink-code
            //
            // Proguard is disabled, because it seems like it is removing
            // ButterKnife generated code and I don't know how to fix it...
            minifyEnabled false
            // "'proguard-android-optimize.txt' includes the same ProGuard rules
            // [as 'proguard-android.txt'], but with other optimizations that
            // perform analysis at the bytecode level—inside and across methods—
            // to reduce your APK size further and help it run faster."
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }

    }
    productFlavors {
    }
}

dependencies {


    compile fileTree(dir: 'libs', include: ['*.jar'])







    compile('com.philliphsu:bottomsheetpickers:2.3.2') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
        exclude group: 'com.android.support', module: 'design'
        exclude group: 'com.android.support', module: 'gridlayout-v7'
    }
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:design:25.1.1'
    compile 'com.android.support:recyclerview-v7:25.1.1'
    compile 'com.android.support:gridlayout-v7:25.1.1'
    compile 'com.android.support:cardview-v7:25.1.1'

    compile 'com.jakewharton:butterknife:8.5.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
    apt 'com.jakewharton:butterknife-compiler:8.5.1'

    apt 'com.google.auto.value:auto-value:1.2'
    provided 'com.google.auto.value:auto-value:1.2'
}

如果你们需要任何其他信息,请告诉我! 提前致谢!

0 个答案:

没有答案