title: Error inflating class android.support.design.internal.BottomNavigationView
body: <p>i'm making my first app.
  it is a simple application with a splash screen and the main activity and now with flavours i have two build variants:</p>
  
  <p><strong><em>Free Version:</em></strong> With Admob banner on bottom of the activity</p>
  
  <p><strong><em>Paid Version:</em></strong> The app don't show admob banner on the bottom but replace it with a Bottom Navigation View for switch activity ( i will add another activity for this).</p>
  
  <p><strong>I tell you that before i add this Bottom Navigation View all part of application work properly, include Build variants.</strong></p>
  
  <p>This is what i did for add Botttom Navigation Menu:</p>
  
  <p>First i put the Bottom Navigation View on the bottom of the xml activity file:</p>
  
  <p><strong>valutausato.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;LinearLayout
      android:layout_marginTop="50dp"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:layout_margin="8dp"
      android:layout_centerHorizontal="true"&gt;
  
      &lt;TextView
          android:id="@+id/TitoloText"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:text="VALUTA IL TUO USATO"
          android:textSize="32dp"
          android:textAlignment="center"
          android:textColor="@color/colorPrimaryDark"
          android:fontFamily="sans-serif-condensed"
          android:layout_weight="1"
          android:textStyle="bold" /&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:focusable="true"
      android:focusableInTouchMode="true"
      android:layout_marginTop="70dp"
      android:layout_marginHorizontal="40dp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:text="Prezzo In Negozio:"
          android:fontFamily="sans-serif"
          android:textStyle="bold|italic"
          android:textColor="#111"
          android:textSize="22dp"/&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="100dp"
      android:layout_centerHorizontal="true"&gt;
  
      &lt;EditText
          android:id="@+id/ProdottoNuovoTxt"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginHorizontal="2dp"
          android:layout_weight="1"
          android:inputType="numberDecimal"
          android:digits="0123456789."
          android:maxLength="30"
          android:text="Inserisci qui il prezzo.."
          android:textSize="22dp"
          android:fontFamily="sans-serif-condensed"
          android:textColor="@color/colorPrimary"/&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="160dp"&gt;
      &lt;CheckBox
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="In Garanzia"
          android:layout_marginRight="0dp"
          android:textSize="17dp" /&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="200dp"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Condizioni prodotto"
          android:fontFamily="sans-serif"
          android:textColor="#111"
          android:textStyle="bold|italic"
          android:textSize="22dp"/&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_marginTop="250dp"
      android:layout_centerHorizontal="true"
      android:layout_marginHorizontal="40dp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:focusable="true"
      android:focusableInTouchMode="true"&gt;
      &lt;Spinner
          android:id="@+id/ProdottoDanneggiatospn"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_marginRight="0dp"
          android:textColor="@color/colorPrimary"
          android:layout_weight="1"/&gt;
  
  &lt;/LinearLayout&gt;
  &lt;LinearLayout
  
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="290dp"&gt;
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Accessori"
          android:layout_weight="1"
          android:fontFamily="sans-serif"
          android:textStyle="bold|italic"
          android:textColor="#111"
          android:textSize="22dp"/&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_marginTop="340dp"
      android:layout_centerHorizontal="true"
      android:layout_marginHorizontal="40dp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"&gt;
      &lt;Spinner
          android:id="@+id/PartiMancantispn"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_marginRight="0dp"
          android:textColor="@color/colorPrimary"
          android:layout_weight="1"/&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_marginTop="400dp"
      android:layout_centerHorizontal="true"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"&gt;
  
      &lt;Button
          android:id="@+id/BtnCalcola"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Calcola"
          android:background="@color/ColorButton"
          android:layout_weight="1"
          android:fontFamily="sans-serif-smallcaps"
          android:textStyle="bold|italic"
          android:textSize="17dp"/&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="470dp"
      android:layout_weight="1"&gt;
  
      &lt;TextView
          android:id="@+id/FormPrezzoFinale"
          android:textSize="22dp"
          android:fontFamily="sans-serif-condensed"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textColor="#002F80"
          android:layout_weight="1"
          android:text="prova"/&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;android.support.design.internal.BottomNavigationView
      android:id="@+id/MenuBottom"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      app:itemBackground="@color/colorPrimary"
      app:itemIconTint="@drawable/background_menu_color"
      app:itemTextColor="@drawable/background_menu_color"
      app:menu="@menu/background_menu_main"/&gt;
  
  &lt;com.google.android.gms.ads.AdView
      xmlns:ads="http://schemas.android.com/apk/res-auto"
      android:id="@+id/SmartBanner"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_alignParentBottom="true"
      android:layout_marginTop="60dp"
      ads:adSize="SMART_BANNER"
      ads:adUnitId="ca-app-pub-3940256099942544/6300978111"&gt;
  &lt;/com.google.android.gms.ads.AdView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>After this i setup my app.build.gradle file with correct dependencies</p>
  
  <p><strong>app.build.gradle</strong></p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
  compileSdkVersion 26
  defaultConfig {
      applicationId "com.viniusapp.value"
      minSdkVersion 15
      targetSdkVersion 26
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  }
  
  buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
  }
  
  flavorDimensions "version"
  
  productFlavors {
      freeVersion {
  
          dimension "version"
          applicationId "com.viniusapp.value.lite"
          versionName = "1.0-lite"           
      }
  
      paidVersion {
  
          dimension "version"        
          applicationId "com.viniusapp.value.premium"
          versionName = "1.0-premium"                    
         }
     }
  }
  
  dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.android.support:appcompat-v7:26.1.0'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.1'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  compile 'com.google.android.gms:play-services-ads:11.8.0'
  compile 'com.android.support:design:26.1.0'
  }
  </code></pre>
  
  <p>Later i create in the drawable folder the file for the bottom navigation view</p>
  
  <p><strong>background_menu_color.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;item android:color="@color/colorPrimaryDark"       android:state_enabled="true"/&gt;
  
      &lt;item android:color="@color/colorPrimary" android:state_enabled="true"/&gt;
  
  &lt;/selector&gt;
  </code></pre>
  
  <p>And finally i create "menu"folder in the main res folder and create the xml file for  menu item  and create two image assets for this two actions.</p>
  
  <p><strong>background_menu_main.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
  
  &lt;item
      android:id="@+id/Action_Value"
      android:enabled="true"
      android:icon="@drawable/ic_value"
      android:title="Valuta"
      app:showAsAction="ifRoom"
      /&gt;
  &lt;item
      android:id="@+id/Action_Search"
      android:enabled="true"
      android:icon="@drawable/ic_search"
      android:title="Cerca Sul Web"
      app:showAsAction="ifRoom"
      /&gt;
  
  &lt;/menu&gt;
  </code></pre>
  
  <p>The last thing i did is add BottomNavigation view in java file (I remove all the rest of the code that was useless for this problem)</p>
  
  <pre><code>package com.vkapp.valutatoreusato;
  
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.Context;
  import android.content.DialogInterface;
  import android.content.SharedPreferences;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.design.internal.BottomNavigationMenuView;
  import android.text.Editable;
  import android.text.InputFilter;
  import android.text.TextWatcher;
  import android.text.method.DigitsKeyListener;
  import android.util.Log;
  import android.view.View;
  import android.view.inputmethod.InputMethodManager;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Spinner;
  import android.widget.TextView;
  import com.google.android.gms.ads.AdListener;
  import com.google.android.gms.ads.AdSize;
  import com.google.android.gms.ads.AdView;
  import com.google.android.gms.ads.MobileAds;
  import com.google.android.gms.ads.AdRequest;
  import com.google.android.gms.ads.InterstitialAd;
  import junit.runner.Version;
  import java.lang.reflect.Type;
  
  
  
  public class ValutaUsato extends Activity {
  
  int Iva = 22;                                  
  double PriceProductNew;                    
  double SalePriceOfProduct = 0;               
  boolean FirstLaunch = true;                         
  int NumeroUtilizziTotali = 0;
  Button BtnCalcola = null;                          
  EditText PriceProductNewTxt = null;                  
  TextView SalePriceText = null;                      
  Spinner DamageProductState = null;                 
  Spinner MissPartProductState = null;                
  InterstitialAd mInterstitialAd;
  AdView SmartBanner;
  BottomNavigationMenuView BottomNavigationMenuMoveForMove = null;
  
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {              
  
      BtnCalcola = (Button) findViewById(R.id.BtnCalcola);          
      BtnCalcola.setEnabled(false);                                 
      PriceProductNewTxt = (EditText) findViewById(R.id.ProdottoNuovoTxt);    
      SalePriceText = (TextView) findViewById(R.id.FormPrezzoFinale);         
      DamageProductState = (Spinner) findViewById(R.id.ProdottoDanneggiatospn);  
      MissPartProductState = (Spinner) findViewById(R.id.PartiMancantispn);   
      BottomNavigationMenuMoveForMove = (BottomNavigationMenuView) findViewById(R.id.MenuBottom);
      BottomNavigationMenuMoveForMove.setEnabled(false);
  
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.valutausato);                         
  
  
      if (BuildConfig.FLAVOR.equals("freeVersion")) {
  
          Log.d("TAG", "Free Version running");
          Log.d("TAG", BuildConfig.APPLICATION_ID);
          Log.d("TAG", BuildConfig.VERSION_NAME);
          MobileAds.initialize(this, "ca-app-pub-3526806334939799/1381568933");
  
          SmartBanner = findViewById(R.id.SmartBanner);
          AdRequest adRequest = new AdRequest.Builder().build();
          SmartBanner.loadAd(adRequest);
  
          mInterstitialAd = new InterstitialAd(this);
          mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
          mInterstitialAd.loadAd(new AdRequest.Builder().build());
          ;
      }
  
      if (BuildConfig.FLAVOR.equals("paidVersion")) {
  
          Log.d("TAG", "Paid Version running");
          BottomNavigationMenuMoveForMove.setEnabled(true);
          Log.d("TAG", BuildConfig.APPLICATION_ID);
          Log.d("TAG", BuildConfig.VERSION_NAME);
  
         }
     }
   }
  </code></pre>
  
  <p>After that my project look like this:</p>
  
  <p><a href="https://i.stack.imgur.com/WdK4F.jpg" rel="nofollow noreferrer">Project Structure</a></p>
  
  <p><a href="https://i.stack.imgur.com/h3ohY.jpg" rel="nofollow noreferrer">Preview of main activity</a></p>
  
  <p>But now when i deubg/run the app the splash screen work good but when the main activity start the app crash with this errors:</p>
  
  <pre><code>01-11 18:07:54.000 7279-7279/com.viniusapp.value.lite E/AndroidRuntime: FATAL EXCEPTION: main
                                                                      Process: com.viniusapp.value.lite, PID: 7279
                                                                      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.viniusapp.value.lite/com.vkapp.valutatoreusato.ValutaUsato}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.design.internal.BottomNavigationView
                                                                          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 #0: Binary XML file line #0: Error inflating class android.support.design.internal.BottomNavigationView
                                                                       Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.design.internal.BottomNavigationView
                                                                       Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.internal.BottomNavigationView" on path: DexPathList[[zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/base.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_dependencies_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_8_apk.apk", zip file "/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.viniusapp.value.lite-yk6VQ4PuiYd-h1puOhz6iA==/lib/x86, /system/lib, /vendor/lib]]
                                                                          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
                                                                          at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                                          at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                          at android.view.LayoutInflater.createView(LayoutInflater.java:606)
                                                                          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 com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:419)
                                                                          at android.app.Activity.setContentView(Activity.java:2669)
                                                                          at com.vkapp.valutatoreusato.ValutaUsato.onCreate(ValutaUsato.java:66)
                                                                          at android.app.Activity.performCreate(Activity.java:6999)
                                                                          at android.app.Activity.performCreate(Activity.java:6990)
                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
  </code></pre>
  
  <p>I see that this error </p>
  
  <pre><code>at com.vkapp.valutatoreusato.ValutaUsato.onCreate(ValutaUsato.java:66)
  </code></pre>
  
  <p>link me this statement</p>
  
  <pre><code>BottomNavigationMenuMoveForMove = (BottomNavigationMenuView) findViewById(R.id.MenuBottom);
  </code></pre>
  
  <p>I hope this is all clear for you.</p>
  
  <p>Thanks for any help</p>