Search code examples
androidxmlandroid-4.4-kitkat

My app work 5.0.2+ but not working older version like kitkat


hello my friends i am new android developer. i am trying to make app. my app work successfully in my phone which android 6.0 but app not working in kitkat. please help me! i tried everything.

Activity_Main.xml

<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" />

app_bar_main.xml

<?xml version="1.0" encoding="utf-8"?>

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"

         />

</android.support.design.widget.AppBarLayout>

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

Myactivity

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
....

Solution

  • I had the same problem:

    The splash screen was not working only in lower version like Kitkat. Later I got to know that the error was not in my code.

    I have set splash screen background using drawable image which I just removed. So check if you have any images in your app.