Note that there are some explanatory texts on larger screens.

plurals
  1. POError inflating class com.google.ads.AdView
    primarykey
    data
    text
    <p>Hello I am new to android dev and admob. I am trying to make a simple test app with a button, a couple pages and admob at the bottom. Everything works fine until I try implementing admob. Here is my code:</p> <p>HelloAndroid.java:</p> <pre><code>package com.manny.HelloAndroid; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ private static final int ACTIVITY_CREATE = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView image = (ImageView) findViewById(R.id.test_image); //image.setScaleType(ImageView.ScaleType.FIT_XY); } public void onClick(View v){ Intent i = new Intent(this, HelloPage2.class); startActivityForResult(i, ACTIVITY_CREATE); } } </code></pre> <p>main.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/test_image" android:src="@drawable/bak_vert_480x800" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:scaleType="fitXY" /&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /&gt; &lt;ImageButton android:id="@+id/test_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/btn_arrow" android:layout_marginLeft="100dp" android:layout_marginTop="200dp" android:onClick="onClick" /&gt; &lt;com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="b14be806e9ddf1f" ads:adSize="BANNER" ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" ads:loadAdOnCreate="true"/&gt; &lt;/RelativeLayout&gt; </code></pre> <p>hello android Manifest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.manny.HelloAndroid" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="7" android:targetSdkVersion="13"/&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"&gt; &lt;activity android:name=".HelloAndroid" 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=".HelloPage2"&gt; &lt;/activity&gt; &lt;activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|s mallestScreenSize"/&gt; &lt;/application&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt; &lt;/manifest&gt; </code></pre> <p>logcat output:</p> <pre><code>05-09 13:12:00.859: D/dalvikvm(24278): GC_EXTERNAL_ALLOC freed 51K, 44% free 3054K/5379K, external 2357K/2773K, paused 94ms 05-09 13:12:00.937: D/dalvikvm(24278): GC_EXTERNAL_ALLOC freed 1K, 44% free 3053K/5379K, external 3857K/4816K, paused 31ms 05-09 13:12:01.085: D/AndroidRuntime(24278): Shutting down VM 05-09 13:12:01.085: W/dalvikvm(24278): threadid=1: thread exiting with uncaught exception (group=0x4001e560) 05-09 13:12:01.109: E/AndroidRuntime(24278): FATAL EXCEPTION: main 05-09 13:12:01.109: E/AndroidRuntime(24278): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.manny.HelloAndroid/com.manny.HelloAndroid.HelloAndroid}: android.view.InflateException: Binary XML file line #30: Error inflating class com.google.ads.AdView 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1702) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1722) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.app.ActivityThread.access$1500(ActivityThread.java:124) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:974) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.os.Handler.dispatchMessage(Handler.java:99) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.os.Looper.loop(Looper.java:130) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.app.ActivityThread.main(ActivityThread.java:3821) 05-09 13:12:01.109: E/AndroidRuntime(24278): at java.lang.reflect.Method.invokeNative(Native Method) 05-09 13:12:01.109: E/AndroidRuntime(24278): at java.lang.reflect.Method.invoke(Method.java:507) 05-09 13:12:01.109: E/AndroidRuntime(24278): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 05-09 13:12:01.109: E/AndroidRuntime(24278): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 05-09 13:12:01.109: E/AndroidRuntime(24278): at dalvik.system.NativeStart.main(Native Method) 05-09 13:12:01.109: E/AndroidRuntime(24278): Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class com.google.ads.AdView 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 05-09 13:12:01.109: E/AndroidRuntime(24278): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:253) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.app.Activity.setContentView(Activity.java:1716) 05-09 13:12:01.109: E/AndroidRuntime(24278): at com.manny.HelloAndroid.HelloAndroid.onCreate(HelloAndroid.java:17) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1666) 05-09 13:12:01.109: E/AndroidRuntime(24278): ... 11 more 05-09 13:12:01.109: E/AndroidRuntime(24278): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.manny.HelloAndroid-2.apk] 05-09 13:12:01.109: E/AndroidRuntime(24278): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) 05-09 13:12:01.109: E/AndroidRuntime(24278): at java.lang.ClassLoader.loadClass(ClassLoader.java:551) 05-09 13:12:01.109: E/AndroidRuntime(24278): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.view.LayoutInflater.createView(LayoutInflater.java:471) 05-09 13:12:01.109: E/AndroidRuntime(24278): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) 05-09 13:12:01.109: E/AndroidRuntime(24278): ... 20 more 05-09 13:12:11.593: I/Process(24278): Sending signal. PID: 24278 SIG: 9 </code></pre> <p>I am using GoogleAdMobAdsSdkAndroid-6.0.0. Again I am very new to this and I have tried using examples off multiple sites but the app continues to crash when it hits a page with admob in it. If someone can help me it would be much appreciated. Thank you. If more code is needed let me know.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload