Linked Questions

Popular Questions

cannot add bottomnavigation to android with gradle 2.3.3

Asked by At

This is the entire activity_main.xml

 <FrameLayout
    android:id="@+id/fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@id/bottom_navigation"
     />
<android.support.design.widget.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@color/colorPrimary"
    app:itemIconTint="@color/colorNavIcon"
    app:itemTextColor="@color/colorNavText"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:menu="@menu/bottom_navigation" />

It shows the error of Process 'command 'Sdk\build-tools\26.0.1\aapt.exe'' finished with non-zero exit value 1 I tried to clean and rebuild the project but just cleaning it would fail on that error my activity_main.xml

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context="com.ibm.watson.developer_cloud.android.myapplication.MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/target_language"
        android:textStyle="bold" />

  <RadioGroup
      android:id="@+id/target_language"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal">

      <RadioButton
          android:id="@+id/spanish"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/spanish"
          android:checked="true" />

      <RadioButton
          android:id="@+id/french"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/french" />

      <RadioButton
          android:id="@+id/italian"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/italian" />

  </RadioGroup>

  <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <EditText
            android:id="@+id/input"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:hint="@string/input_hint" />

        <ImageButton
            android:id="@+id/mic"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_mic"
            android:contentDescription="@string/microphone" />

    </LinearLayout>

  <Button
      android:id="@+id/translate"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/translate"
      android:enabled="false" />

  <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageButton
            android:id="@+id/play"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_play"
            android:contentDescription="@string/play" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:text="@string/translation_label"
            android:textStyle="bold" />

    </LinearLayout>

    <TextView
        android:id="@+id/translated_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

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

    <Button
        android:id="@+id/gallery_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Gallery"
        />

    <Button
        android:id="@+id/camera_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Camera"
        />


  </LinearLayout>

    <TextView
        android:id="@+id/resultTextView"
        android:layout_width="match_parent"
        android:layout_height="@dimen/edittext_height_100dp"
        android:layout_margin="8dp"
        android:textSize="@dimen/textSize20sp"
        android:padding="@dimen/padding8dp"
        android:textColor="@color/red"
        android:textColorHint="@color/red"
        android:hint="@string/your_input_speech_will_be_displayed_here"
        android:background="@drawable/rounded_edittext"/>
    <FrameLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@id/bottom_navigation"
         />
    <android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/colorPrimary"
        app:itemIconTint="@color/colorNavIcon"
        app:itemTextColor="@color/colorNavText"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:menu="@menu/bottom_navigation" />
</LinearLayout>

my bottom_navigation.xml

   <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/nav_dialer"
        android:icon="@drawable/ic_dialerlightblue"
        android:title="Dial"/>
    <item
        android:id="@+id/nav_contacts"
        android:icon="@drawable/ic_people"
        android:title="Contacts"/>
    <item
        android:id="@+id/nav_transcripts"
        android:icon="@drawable/ic_transcripts"
        android:title="Transcripts"/>
    <item
        android:id="@+id/nav_settings"
        android:icon="@drawable/ic_tapnavsettings"
        android:title="Settings"/>
</menu>

with this whole code, I cannot compile it and prompts that error.

Related Questions