title: Error inflating class com.google.android.gms.ads.Adview (Android Studio)
body: <p>I'm getting an error when I try to put AdMob ads in my Android App. I've already did it with Eclipse + ADT, but when I try with Android Studio, it's not working. I guess I have a poor understanding on how to configure the project in Android Studio. I'll put some details below:</p>
  
  <p>Stack Trace Error:</p>
  
  <pre><code>10-17 23:57:05.910    2067-2067/com.nlpoomanual E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: com.nlpoomanual, PID: 2067
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nlpoomanual/br.com.nlpoomanual.activity.AjudeNosActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class com.google.android.gms.ads.Adview
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
              at android.app.ActivityThread.access$800(ActivityThread.java:144)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:135)
              at android.app.ActivityThread.main(ActivityThread.java:5221)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
       Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class com.google.android.gms.ads.Adview
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
              at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
              at br.com.nlpoomanual.activity.AjudeNosActivity.onCreate(AjudeNosActivity.java:25)
              at android.app.Activity.performCreate(Activity.java:5937)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
              at android.app.ActivityThread.access$800(ActivityThread.java:144)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:135)
              at android.app.ActivityThread.main(ActivityThread.java:5221)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
       Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.Adview" on path: DexPathList[[zip file "/data/app/com.nlpoomanual-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
              at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
              at android.view.LayoutInflater.createView(LayoutInflater.java:571)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
              at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
              at br.com.nlpoomanual.activity.AjudeNosActivity.onCreate(AjudeNosActivity.java:25)
              at android.app.Activity.performCreate(Activity.java:5937)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
              at android.app.ActivityThread.access$800(ActivityThread.java:144)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:135)
              at android.app.ActivityThread.main(ActivityThread.java:5221)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
      Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.ads.Adview
              at java.lang.Class.classForName(Native Method)
              at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
              at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
              ... 25 more
       Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
  </code></pre>
  
  <p>AjudeNosActivity.java</p>
  
  <pre><code>package br.com.nlpoomanual.activity;
  
  import android.content.Intent;
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.AdapterView;
  import android.widget.RadioButton;
  import android.view.View;
  import android.widget.RadioGroup;
  
  import br.com.nlpoomanual.R;
  import br.com.nlpoomanual.bean.Sugestao;
  import com.google.android.gms.ads.AdRequest;
  import com.google.android.gms.ads.AdView;
  
  public class AjudeNosActivity extends ActionBarActivity {
  
      Sugestao sugestao = null;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.ajude_nos);
          AdView ajudeNosAdAview = (AdView) findViewById (R.id.ajudeNosAdView);
          AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
          ajudeNosAdAview.loadAd (adRequest);
      }
  
  
      /* Other methods that I believe that are unecessary to show...
       */
  }
  </code></pre>
  
  <p>res/layout/ajude_nos.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:ads="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;ScrollView
          android:id="@+id/scroll"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;LinearLayout
              android:id="@+id/linear"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              &gt;
  
              &lt;com.google.android.gms.ads.Adview
                  android:id="@+id/ajudeNosAdView"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerHorizontal="true"
                  android:layout_alignParentTop="true"
                  ads:adSize="BANNER"
                  ads:adUnitId="ca-app-pub-7700319823577941/5947568710"
              /&gt;
              &lt;TextView
                  android:id="@+id/desc_ajude_nos"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  style="@style/texto_comum"
                  android:text="@string/desc_ajude_nos"
                  android:layout_margin="15dp"
                  /&gt;
  
              &lt;RadioGroup
                  android:id="@+id/rg_ajude_nos"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"
                  android:background="@color/pink"
                  &gt;
                  &lt;RadioButton
                      android:id="@+id/rb_sugestao_produto"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="@string/rb_sugestao_produto"
                      android:onClick="onRadioButtonClicked"
                      android:checked="true"
                      android:background="@color/background_white"
                      android:layout_marginBottom="7dp"
                      android:layout_marginTop="7dp"
                      /&gt;
                  &lt;RadioButton
                      android:id="@+id/rb_sugestao_componente"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="@string/rb_sugestao_componente"
                      android:onClick="onRadioButtonClicked"
                      android:background="@color/background_white"
                      android:layout_marginBottom="7dp"
                      /&gt;
                  &lt;RadioButton
                      android:id="@+id/rb_sugestao_termo"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="@string/rb_sugestao_termo"
                      android:onClick="onRadioButtonClicked"
                      android:background="@color/background_white"
                      android:layout_marginBottom="7dp"
                      /&gt;
                  &lt;RadioButton
                      android:id="@+id/rb_comunique_erro"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="@string/rb_comunique_erro"
                      android:onClick="onRadioButtonClicked"
                      android:background="@color/background_white"
                      android:layout_marginBottom="7dp"
                      /&gt;
  
                  &lt;RadioButton
                      android:id="@+id/rb_outros"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="@string/rb_outros"
                      android:onClick="onRadioButtonClicked"
                      android:background="@color/background_white"
                      android:layout_marginBottom="7dp"
                      /&gt;
  
              &lt;/RadioGroup&gt;
  
              &lt;Button
                  android:id="@+id/bt_proximo"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/bt_proximo"
                  android:layout_gravity="center"
                  android:layout_margin="20dp"
                  android:onClick="onButtonClicked"
                  android:background="@color/pink"
                  android:textColor="@color/background_white"
                  /&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>app/build.gradle</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.1"
  
      defaultConfig {
          applicationId "com.nlpoomanual"
          minSdkVersion 11
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:23.0.1'
      compile 'com.google.android.gms:play-services-ads:8.1.0'
      compile files('libs/google-play-services.jar')
  }
  </code></pre>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest
      xmlns:android="http://schemas.android.com/apk/res/android"
      package="br.com.nlpoomanual" &gt;
      &lt;uses-sdk
          android:minSdkVersion="11"
          android:targetSdkVersion="23"
          &gt;
      &lt;/uses-sdk&gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_afrogirl"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".activity.TelaInicial"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".activity.SobreActivity"
              android:label="@string/sobre_titulo" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".activity.AjudeNosActivity"
              android:label="@string/title_activity_ajude_nos" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".activity.DicionarioDeTermos"
              android:label="@string/title_activity_dicionario_de_termos" &gt;
          &lt;/activity&gt;
          &lt;activity android:name=".activity.DescricaoTermoActivity"
                    android:label="@string/dicionario"
              &gt;
          &lt;/activity&gt;
          &lt;activity android:name=".activity.BuscaComponentesActivity"
                    android:label="@string/busca_componentes"&gt;
          &lt;/activity&gt;
          &lt;activity android:name=".activity.TipoProdutoActivity"
                    android:label="@string/produtos_liberados"
              &gt;
          &lt;/activity&gt;
          &lt;activity android:name=".activity.BuscaProdutosActivity"
                    android:label="@string/produtos_liberados"
              &gt;
          &lt;/activity&gt;
          &lt;activity android:name=".activity.DescricaoProdutoActivity"
                    android:label="@string/produtos_liberados"
              &gt;
          &lt;/activity&gt;
          &lt;activity android:name=".activity.MenuPrincipalActivity"
                    android:label="@string/app_name"&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".activity.FotoProdutoActivity"
              android:label="@string/produtos_liberados"
              &gt;
          &lt;/activity&gt;
          &lt;activity android:name="com.google.android.gms.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
              android:theme="@android:style/Theme.Translucent" /&gt;
      &lt;/application&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>I guess these files should help understanding the problem.
  Thanks in advance...</p>