2016-08-04 3 views
2

APIレベル19(Kit Kat)で私のアプリケーションがエラーになりました。私はAndroidのサポートライブラリ24.0.0を実装し、私の活動を開始し、次のエラーを取得:ファイルres/drawable/abc_ic_ab_back_material.xmlが見つかりません

Exception while inflating <vector> 
org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0 

さらに下のスタックトレースで

java.lang.RuntimeException: Unable to start activity ComponentInfo{ironicdev.android.openleaf/ironicdev.android.openleaf.ui.activity.MainActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.v7.widget.Toolbar 

、その後

Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020016 
のようなものがあります

(完全なスタックトレースを投稿したくありませんでした)。

私はGoogleでいくつかのソリューションは、私のGradleファイルに「真vectorDrawables.useSupportLibrary =」に設定したいました。しかし、それは役に立たなかった。私はメニューバーの "クリーンプロジェクト"を選択しますが、何も表示されません。

また、私はすべての私のベクトルのxmlファイルを削除し、PNGファイルに置き換え。しかし、エラーはまだそこにあります。

API 21以上で始めるとすべて問題ありません。

どうすればいいですか?

編集:ここで(エラーがスローされます)MainActivtyから私のXMLコードがある

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:openDrawer="start"> 

    <include 
     layout="@layout/app_bar_main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:headerLayout="@layout/nav_header_main" 
     app:menu="@menu/activity_main_drawer" /> 

</android.support.v4.widget.DrawerLayout> 

content_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.NestedScrollView 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" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context=".ui.activity.MainActivity" 
    tools:showIn="@layout/app_bar_main"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <include layout="@layout/extended_app_bar_main" /> 

     <include layout="@layout/content_dashboard_diagram" /> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="12dp" 
      android:text="@string/tv_newest_entries" /> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/rv_newest_entries" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"/> 
    </LinearLayout> 
</android.support.v4.widget.NestedScrollView> 

extended_app_bar_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout android:layout_below="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:padding="16dp" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:background="@color/colorPrimary" 
    app:layout_scrollFlags="scroll|enterAlways"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/tv_simple_search" 
     android:textColor="@color/colorFontInverted" 
     android:textAppearance="@style/TextAppearance.AppCompat.Body1" 
     android:visibility="gone"/> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="8dp" 
     android:orientation="horizontal"> 

     <EditText 
      android:id="@+id/et_simple_search" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:textColorHint="@android:color/white" 
      android:textColor="@color/colorFontInverted" 
      android:hint="@string/hint_simple_search" /> 

     <ImageButton 
      android:id="@+id/btn_simple_search" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:background="@android:color/transparent" 
      android:src="@drawable/ic_magnify_white_24dp" /> 
    </LinearLayout> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="end" 
     style="@style/Widget.AppCompat.Button.Colored" 
     android:theme="@style/Accent.Button" 
     android:text="@string/btn_advanced_search"/> 
</LinearLayout> 

content_dashboard_diagram.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="220dp" 
    android:orientation="vertical"> 

    <com.github.mikephil.charting.charts.PieChart 
     android:layout_margin="12dp" 
     android:id="@+id/pie_categories" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
</LinearLayout> 
+0

uがウルXMLコードを投稿することができます?あなたはSDK 21+ – Kathi

+0

私は私のコード – Surras

+0

*と私の質問を編集し、すべての罰金*ですだから、私はエラーを避け、私のアプリをAPI 19で起動可能にするために何をすべきですか?私はこのリソースを一度も使用していません –

答えて

1

私は数日前にこの問題に直面しました。

私はこの問題を説明する公式のトラッカー上の問題を作成したあなたの活動のテーマのすべてがTheme.AppCompatから延び、これは

を固定する必要があることを確認してください:https://code.google.com/p/android/issues/detail?id=219724

関連する問題