嘿,最后我创建了 android 应用程序和整数广告暴民,但是当在我的模拟器上尝试时让我意外停止 *这里是我的代码文件*
科尔多瓦-2.2.0 * admobskd 6.2.1 * 安卓 2.2
这里 mainActivity.java
package com.afrogfx.VerbTenses;
import android.app.Activity;
import android.os.Bundle;
import com.google.ads.*;
import org.apache.cordova.*;
public class VerbTenses extends DroidGap
{
private static final String AdMob_Ad_Unit = "ass0bcc0e6a0228";
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl("file:///android_asset/www/overview.html");
//admob
adView = new AdView(this, AdSize.BANNER, AdMob_Ad_Unit);
super.root.addView(adView);
AdRequest request = new AdRequest();
//request.setTesting(false);
adView.loadAd(request);
}
}
这里 manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:windowSoftInputMode="adjustPan"
package="com.afrogfx.VerbTenses"
android:versionName="1.1"
android:versionCode="5" >
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:allowBackup="true"
>
<activity android:name="VerbTenses" android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard">
<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"/>
</application>
<uses-sdk android:minSdkVersion="2" android:targetSdkVersion="17"/>
</manifest>
警告 从未使用过 import android.app.Activity
控制台 http://www.flickr.com/photos/afrogfx/8350084864/
LogCat http://www.flickr.com/photos/afrogfx/8350087082/
01-05 17:21:21.565: D/dalvikvm(726): DexOpt: couldn't find static field
01-05 17:21:21.565: W/dalvikvm(726): VFY: unable to resolve static field 19 (SDK_INT) in Landroid/os/Build$VERSION;
01-05 17:21:21.575: W/dalvikvm(726): VFY: rejecting opcode 0x60 at 0x0005
01-05 17:21:21.575: W/dalvikvm(726): VFY: rejected Lorg/apache/cordova/DroidGap;.init ()V
01-05 17:21:21.575: W/dalvikvm(726): Verifier rejected class Lorg/apache/cordova/DroidGap;
01-05 17:21:21.575: W/dalvikvm(726): Class init failed in newInstance call (Lcom/afrogfx/VerbTenses/VerbTenses;)
01-05 17:21:21.589: D/AndroidRuntime(726): Shutting down VM
01-05 17:21:21.589: W/dalvikvm(726): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
01-05 17:21:21.607: E/AndroidRuntime(726): Uncaught handler: thread main exiting due to uncaught exception
01-05 17:21:21.625: E/AndroidRuntime(726): java.lang.VerifyError: org.apache.cordova.DroidGap
01-05 17:21:21.625: E/AndroidRuntime(726): at java.lang.Class.newInstanceImpl(Native Method)
01-05 17:21:21.625: E/AndroidRuntime(726): at java.lang.Class.newInstance(Class.java:1472)
01-05 17:21:21.625: E/AndroidRuntime(726): at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
01-05 17:21:21.625: E/AndroidRuntime(726): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2186)
01-05 17:21:21.625: E/AndroidRuntime(726): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
01-05 17:21:21.625: E/AndroidRuntime(726): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
01-05 17:21:21.625: E/AndroidRuntime(726): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
01-05 17:21:21.625: E/AndroidRuntime(726): at android.os.Handler.dispatchMessage(Handler.java:99)
01-05 17:21:21.625: E/AndroidRuntime(726): at android.os.Looper.loop(Looper.java:123)
01-05 17:21:21.625: E/AndroidRuntime(726): at android.app.ActivityThread.main(ActivityThread.java:3948)
01-05 17:21:21.625: E/AndroidRuntime(726): at java.lang.reflect.Method.invokeNative(Native Method)
01-05 17:21:21.625: E/AndroidRuntime(726): at java.lang.reflect.Method.invoke(Method.java:521)
01-05 17:21:21.625: E/AndroidRuntime(726): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
01-05 17:21:21.625: E/AndroidRuntime(726): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
01-05 17:21:21.625: E/AndroidRuntime(726): at dalvik.system.NativeStart.main(Native Method)
01-05 17:21:21.644: I/dalvikvm(726): threadid=7: reacting to signal 3
01-05 17:21:21.745: I/dalvikvm(726): Wrote stack trace to '/data/anr/traces.txt'
01-05 17:23:13.524: I/Process(726): Sending signal. PID: 726 SIG: 9