简体   繁体   中英

Error inflating class com.google.ads.AdView

Alright, so I've been going through the tutorial in AdMob, and after trying to compile, I was first faced this annoying run time error.
I've been trying for the past few hours to fix it and trying some solutions, such as putting the JAR file in the libs folder and so on.. but I keep getting this error.
I will be very thankfull if someone could look into my problem and figure out what I am probably doing wrong.

First, my logcat: http://pastebin.com/4tRh31Xh

Here's how it looks:

在此处输入图片说明在此处输入图片说明

My Manifest:

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

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="18" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.flash" />

<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application
    android:name="org.holoeverywhere.app.Application"
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:icon="@drawable/safecam_icon"
    android:label="@string/app_name"
    android:theme="@style/Holo.Theme.Light.DarkActionBar" >
    <activity
        android:name="com.inturnex.safecam.MainActivity"
       android:configChanges="orientation|screenSize|keyboardHidden"
       android:screenOrientation="portrait"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
       <activity android:name="com.google.ads.AdActivity"
          android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>

My layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ProgressBar
    android:id="@+id/progressBar"
    style="?android:attr/progressBarStyleLarge"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true" />

<ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@+id/linearLayout1"
    android:divider="@null"
    android:dividerHeight="0dp" />

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:orientation="vertical" >

    <com.google.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="xxxx"
        ads:loadAdOnCreate="true"/>
</LinearLayout>

Alright, finally, I figured out what the problem is. I had to look a bit deeper in the logcat.

I use HoloEverywhere library, as you can see in the end of the logcat file, it says:

Caused by: java.lang.UnsatisfiedLinkError: HoloEverywhere: PreferenceFramework not found

The solution: I had to import the HoloEverywhere Addons Preferences library into my project, and now it works like a charm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM