- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将 ad-mobs 广告添加到我的 Android 应用程序中,我已经安装了 Google play services 17 软件包,并将该软件包从 sdk>extras>google>google play service 复制到我的工作空间>myproject>lib> __ 并将 google-play-service_lib 文件导入到我的工作区。之后,我将 google-play-service.jar 添加到我的项目>java构建路径>库中,并且我还检查了顺序和导出。
但我徒劳地在 main.xml 中收到一个错误,因为 Element com.google.andriod.gsm.ads.AdView 未知,但它在 emluator 中编译并启动 Activity ,但出现运行时错误。
我浏览了很多帖子,但没有一个让我足够清楚。
以下是我的项目的主要内容:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.SAI.banner"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<activity
android:name="com.SAI.banner.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
</manifest>
Main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/bg"
tools:context="com.SAI.banner.MainActivity$PlaceholderFragment" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="@string/hello_world" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3131326757457805/934xxxxxxx" >
</com.google.android.gms.ads.AdView>
</RelativeLayout>
MainActivity.java
package com.SAI.banner;
import android.support.v7.app.ActionBarActivity;
import com.google.android.gms.ads.*;
import android.os.Bundle;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Look up the AdView as a resource and load a request.
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
}
提前感谢 Saikiran。请帮我解决这个问题。
最佳答案
我遇到了这个问题。当我通过以下步骤添加 Google Play 服务时,我的问题得到了解决:
关于java - 元素 <com.google.android.gms.ads.AdView> 未知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24220200/
我的设备有一项需要 24/7 全天候工作的前台服务。有时,当 gms 更新发生时,它会终止所有 gms 服务并重新启动它们。 我的服务也在使用 gms(firbase AuthService),所以它
我的应用程序的 OS 4.x 版本中止找不到类 .NoClassDefFoundError: com.google.android.gms.internal.zzno。当手机使用更高版本的 Googl
我是新的 Android 设备,并且对支付部分更加陌生,我正在通过此链接将 Gpay 实现到我的应用程序中 https://developers.google.com/pay/api/android/
我有一个已发布 Alpha 版本的应用。 我在我的应用程序中使用 Places SDK for Android、Mobile Crash Reporting API、Firebase Services
实际上,我正在尝试制作一个具有免费和付费风格的应用程序。当我使用简单的 findViewById 方法进行绑定(bind)时,它工作正常。但是当我尝试添加 butterknife 时,我拼命坚持使用
我尝试在更新 android studio 3.2.1 后修复我的应用程序的一些功能。但似乎我得到了更多的错误。当我尝试重建应用程序时。我收到了这个信使: Error: Type com.google
我试着在Stackoverflow上搜索,并尝试了其他类似性质的Stackoverflow问题中建议的解决方案,比如这个和那个,但我仍然得到以下错误插件[id:‘com.google.gms.goog
可能已经在其他一些上下文和依赖项中询问了这个问题。 但即使花了一整天,我仍然无法弄清楚这一点。 所以下面我将完整的错误日志与我的项目级 Gradle 文件和应用级 Gradle 文件一起粘贴。 尝试运
我将 com.google.android.gms:play-services-location 更新为 9.0.2 到 9.4.0 一切正常但无法解析 PlaceAutocompleteFragme
在 'com.google.android.gms:play-services-location:9.4.0' 无法导入导入com.google.android.gms.location.places
我将 com.google.android.gms:play-services-ads 更新为 15.0.2 并将类路径 com.google.gms:google-services: 更新为 3.3
我之前问过如何显示不同的markerInfoWindow in this question , 现在,当用户单击左角的按钮时,我正在尝试删除特定的标记。 首先在 .h 文件中: NSMutableAr
如何通过这种方法获得经纬度? - (void)mapView:(GMSMapView )mapView didEndDraggingMarker:(GMSMarker )marker; 我想在调用 d
我正在为我的 iOS 应用程序使用 Google Maps SDK。 我将其配置为当点击 GMSMarker 时,它会显示它的标题。一切正常。 我想对 GMSPolyline 做同样的事情,但不知道怎
我正在尝试使用 Google Play 游戏服务 API 为成就绘制图标。 然而,它正在默默地失败。 方法/问题: 图片的URI成功获取,存在且有效。 我使用 ImageManager.loadIma
我收到错误消息是因为我在尝试使用 Google 的应用程序索引库的同时还导入了一个库,该库将旧版本的 android gms 库用于不同的组件 - 来自 Google 的 cast 库玩服务。错误状态
Google 跟踪代码管理器可以在没有 Google 移动服务或 Firebase Analytics 的设备上运行吗? 例如:华为手机没有谷歌服务,只有华为服务在运行。 最佳答案 据我所知,Goog
如何同时拥有 Google 移动服务和 华为 应用程序中的移动服务? 就是这样 华为 已丢失超过 的许可证手机短信 ,看来我们需要替换所有手机短信 的应用程序中使用的服务华为 提供的。什么是“最佳实践
我确实如此 - 和许多开发人员一样,对臭名昭著的 android 65000 方法限制有问题。我已经对我的应用程序进行了多重索引,但我真的很想以某种方式使其更轻。 这是我的应用程序方法的图表(使用 d
我正在使用 JGroups 4.0.15.Final 来实现集群应用程序。当我启动两个节点时一切正常,它们连接并开始工作。但是当我杀死/重新启动一个节点时,它们将不再连接在一起。 注意:它们是我应用程
我是一名优秀的程序员,十分优秀!