AdMob的错误:没有找到类" com.google.ads.AdView" [英] AdMob error: Didn't find class "com.google.ads.AdView"

查看:199
本文介绍了AdMob的错误:没有找到类" com.google.ads.AdView"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

和所以我在Android Studio的v 0.3.6我有问题,谷歌播放服务。我已经使用了Admob的罐​​子在我的项目,但我不得不更新它,所以我试图通过的说明。我的项目编译正常但是当我试图运行一个活动,我得到了以下错误:

So I'm on Android Studio v 0.3.6 and I'm having problems with Google Play Services. I was already using the Admob jar in my project but I had to update it so I tried to add them via the instructions. My project compiles fine however when I try to run an activity I get the following error:

Didn't find class "com.google.ads.AdView" on path: /data/app/com.mre. example-1. apk

请参阅完整的错误这里有关我build.gradle的部分输出:

See the full error output here Relevant portion of my build.gradle:

apply plugin: 'android'

dependencies {
    compile 'com.android.support:support-v4:13.0.+'
    compile 'com.google.android.gms:play-services:4.0.30'
    //compile project(':libraries:google-play-services_lib')
    //compile files('libs/google-play-services.jar')
    ... 
}

android {
     compileSdkVersion 18
     buildToolsVersion '18.0.1'
     defaultConfig {
         minSdkVersion 8
        targetSdkVersion 18
    }
}

下面是我的清单

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />

<application
    android:allowBackup="true"
    android:icon="@drawable/logo"
    android:label="@string/app_name"ex">

    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    <meta-data
        android:name="com.google.android.gms.games.APP_ID"
        android:value="@string/app_id" />

    <meta-data
        android:name="com.google.android.gms.appstate.APP_ID"
        android:value="@string/app_id" />
    ...
    <activity
        android:name="com.google.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

</application>

下面的布局:

<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">
...
        <com.google.ads.AdView
            android:id="@+id/adView"
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            ads:adSize="BANNER"
            ads:adUnitId="@string/ad_unit_id"
            ads:loadAdOnCreate="true"
            ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
            android:gravity="center" />
...
</RelativeLayout>

在过去的两天我已经尝试添加了GPS库到我的项目,只是罐子既无法比拟的每一个变化。起初,我删除了瓶子从我/库,并添加所需的行我build.gradle但也不能工作。我感谢你提前任何帮助,您可以提供。

Over the past two days I have tried every variation of adding the GPS library to my project, to just the jar to both to none. At first I deleted the jar from my /libs and added the required lines to my build.gradle but that didn't work either. I thank you in advance for any help you can provide.

推荐答案

包装改为com.google.android.gms.ads.AdRequest和com.google.android.gms.ads.AdView

The package changed to com.google.android.gms.ads.AdRequest and com.google.android.gms.ads.AdView

更改您的导入和您的布局

Change your import and your layouts

教程迁移的apk。

这篇关于AdMob的错误:没有找到类&QUOT; com.google.ads.AdView&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆