谁能帮助我,从过去两天开始,我一直在尝试在 android 中实现 admob,但是收到以下错误消息-
08-08 19:05:33.362: W/webcore(3228): 在第一个布局后无法获取 viewWidth 08-08 19:10:51.632: W/dalvikvm(3328): VFY: 无法解析直接方法 3204 :Landroid/webkit/WebView;。(Landroid/content/Context;Landroid/util/AttributeSet;IZ)V 08-08 19:10:51.662: I/webclipboard(3328):clipservice: android.sec.clipboard.ClipboardExManager@40534500 08-08 19:10: 52.142:I/CordovaLog(3328):将日志级别更改为 DEBUG(3) 08-08 19:10:52.142:I/CordovaLog(3328):找到 useBrowserHistory=false 的首选项 08-08 19:10:52.142:D/ CordovaLog(3328):找到 useBrowserHistory=false 的首选项 08-08 19:10:52.152:E/dalvikvm(3328):找不到类 'android.webkit.WebResourceResponse',引用自方法 org.apache.cordova.CordovaWebViewClient。 generateWebResourceResponse 08-08 19:10:52.152: W/dalvikvm(3328): VFY:无法解析 Lorg/apache/cordova/CordovaWebViewClient 中的新实例 467 (Landroid/webkit/WebResourceResponse;);08-08 19:10:52.152: W/dalvikvm(3328): VFY: 无法找到签名中引用的类 (Landroid/webkit/WebResourceResponse;) 08-08 19:10:52.182: W/dalvikvm(3328): VFY : 找不到签名中引用的类 (Landroid/webkit/WebResourceResponse;) 08-08 19:10:52.182: W/dalvikvm(3328): VFY: 找不到签名中引用的类 (Landroid/webkit/WebResourceResponse;) 08 -08 19:10:52.182: W/dalvikvm(3328): VFY: 无法解析虚拟方法 3225: Landroid/webkit/WebViewClient;.shouldInterceptRequest (Landroid/webkit/WebView;Ljava/lang/String;)Landroid/webkit/ Web资源响应;08-08 19:10:52.182: D/DroidGap(3328): DroidGap.init() 08-08 19:10:52.192: D/CordovaWebView(3328): >>> loadUrl(file:///android_asset/www/index.html) 08-08 19:10:52.192: D/PluginManager(3328): init() 08-08 19:10:52.212: D/CordovaWebView(3328): >>> loadUrlNow() 08-08 19:10:52.272: E/Ads(3328): 找不到 com.google.ads.AdActivity,请确保它已在 AndroidManifest.xml 中注册。08-08 19:10:52.272:E/Ads(3328):您必须在 AndroidManifest.xml 中使用 configChanges 声明 AdActivity。08-08 19:10:52.282:I/webclipboard(3328):clipservice:android.sec.clipboard.ClipboardExManager@405512e0 08-08 19:10:52.332:I/webclipboard(3328):clipservice:android.sec.clipboard .ClipboardExManager@405512e0 08-08 19:10:52.902: D/AndroidRuntime(3328): 关闭 VM 08-08 19:10:52.902: W/dalvikvm(3328): threadid=1: 线程以未捕获的异常退出(组= 0x40018578) 08-08 19:10:52.902: E/AndroidRuntime(3328):
Following is the code of my main java file -
import org.apache.cordova.*;
import com.google.ads.*;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;
import android.widget.*;
public class Albania extends DroidGap {
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
super.setIntegerProperty("loadUrlTimeoutValue", 70000);
adView = new AdView(this, AdSize.BANNER, "a1502224a0ab1f8");
LinearLayout layout = (LinearLayout) findViewById(R.id.adView);
layout.addView(adView);
adView.loadAd(new AdRequest()); }
这是我的 activity_appname.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/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:padding="@dimen/padding_medium"
android:text="@string/hello_world"
tools:context=".Albania" />
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, S567041ba118d"
ads:loadAdOnCreate="true"/>
</RelativeLayout>
这是我的 android manifest.xml 文件
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Albania"
android:label="@string/title_activity_albania"
android:configChanges="orientation|keyboardHidden|orientation|keyboard|screenSize|uiMode|screenLayout|locale"
android:hardwareAccelerated="true" >
<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>
</manifest>