android中的通胀异常

时间:2018-03-06 10:18:53

标签: android exception

我无法解决这个通货膨胀例外问题。

我的布局文件内容是: audit_form_activity:

<LinearLayout
    android:id="@+id/main_layout"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <!-- our toolbar -->
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

    <!-- our tablayout to display tabs  -->
    <android.support.design.widget.TabLayout
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabMode="scrollable"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>

    <!-- View pager to swipe views -->
    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"/>


    <com.csr.audit.adapters.ExpandableHeightGridView
        android:id="@+id/gridviewimg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:horizontalSpacing="3dp"
        android:isScrollContainer="false"
        android:numColumns="3"
        android:stretchMode="columnWidth"
        android:verticalSpacing="3dp" />


</LinearLayout>

我在布局中使用viewpager和tablayout的方式有问题吗?如果是这样,我该如何正确使用它?

这是我的logcat中的错误:

FATAL EXCEPTION: main
                                                               Process: com.csr.audit, PID: 13337
                                                               java.lang.RuntimeException: Unable to start activity ComponentInfo{com.csr.audit/com.csr.audit.AuditForm}: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class <unknown>
                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
                                                                   at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
                                                                   at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                   at android.os.Looper.loop(Looper.java:164)
                                                                   at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
                                                                Caused by: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class <unknown>
                                                                Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>
                                                                Caused by: java.lang.reflect.InvocationTargetException
                                                                   at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                   at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
                                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:647)
                                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
                                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
                                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
                                                                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                   at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
                                                                   at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                                                                   at com.csr.audit.AuditForm.onCreate(AuditForm.java:148)
                                                                   at android.app.Activity.performCreate(Activity.java:7009)
                                                                   at android.app.Activity.performCreate(Activity.java:7000)
                                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
                                                                   at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
                                                                   at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                   at android.os.Looper.loop(Looper.java:164)
                                                                   at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
                                                                Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f01011f a=-1}
                                                                   at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:944)
                                                                   at android.content.res.TypedArray.getDrawable(TypedArray.java:928)
                                                                   at android.view.View.<init>(View.java:4768)
                                                                   at android.view.ViewGroup.<init>(ViewGroup.java:597)
                                                                   at android.view.ViewGroup.<init>(ViewGroup.java:593)
                                                                   at android.support.v7.widget.Toolbar.<init>(Toolbar.java:203)
                                                                   at android.support.v7.widget.Toolbar.<init>(Toolbar.java:199)
                                                                   at java.lang.reflect.Constructor.newInstance0(Native Method) 
                                                                   at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 
                                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:647) 
                                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) 
                                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) 
                                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) 
                                                                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                                   at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
                                                                   at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
                                                                   at com.csr.audit.AuditForm.onCreate(AuditForm.java:148) 
                                                                   at android.app.Activity.performCreate(Activity.java:7009) 
                                                                   at android.app.Activity.performCreate(Activity.java:7000) 
                                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) 
                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) 
                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
                                                                   at android.app.ActivityThread.-wrap11(Unknown Source:0) 
                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
                                                                   at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                   at android.os.Looper.loop(Looper.java:164) 
                                                                   at android.app.ActivityThread.main(ActivityThread.java:6494) 
                                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                                   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
03-06 15:23:41.147 1573-1667/? E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
03-06 15:23:41.151 1446-3794/? E/AudioFlinger: not enough memory for AudioTrack size=131296
03-06 15:23:41.151 1446-3794/? E/AudioFlinger: createRecordTrack_l() initCheck failed -12; no control block?
03-06 15:23:41.151 2133-13352/? E/AudioRecord: AudioFlinger could not create record track, status: -12
03-06 15:23:41.192 2133-13352/? E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -12.
03-06 15:23:41.192 2133-13352/? E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
03-06 15:23:41.193 2133-13352/? E/ActivityThread: Failed to find provider info for com.google.android.apps.gsa.testing.ui.audio.recorded
03-06 15:23:41.736 2014-12577/? E/ctxmgr: [ProducerStatusImpl]updateStateForNewContextData: inactive, contextName=7
03-06 15:23:41.804 2014-2014/? E/BeaconBle: Missing BluetoothAdapter
03-06 15:23:41.816 2014-2014/? E/BeaconBle: Scan couldn't start for Places
03-06 15:23:46.242 1446-3582/? E/AudioFlinger: not enough memory for AudioTrack size=131296

请帮我解决这个问题。我google了很多,在stackoverflow上发现了类似的问题,试图使用解决方案,但失败了。 任何帮助将不胜感激。谢谢!

0 个答案:

没有答案