横幅广告崩溃Android应用程序

时间:2013-02-03 00:35:22

标签: java android admob ads

由于某种原因,这一行

adView = new AdView(this, AdSize.BANNER, "xxxxxx");//adUnitId is actually there

在我尝试运行它时会崩溃我的Android应用程序。

我输入了GoogleAdMod jar文件,但没有任何内容

project.properties

target=android-16

AndroidManifest

<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

我一直在这个房子,并尝试过通过xml和类,但我很难过。

提前致谢

-Ben

编辑:记录

02-02 18:51:14.028: W/IInputConnectionWrapper(11019): getSelectedText on inactive InputConnection
02-02 18:51:14.028: W/IInputConnectionWrapper(11019): setComposingText on inactive InputConnection
02-02 18:51:18.693: I/Choreographer(11019): Skipped 32 frames!  The application may be doing too much work on its main thread.
02-02 18:51:18.763: E/dalvikvm(11019): Could not find class 'com.google.ads.AdView', referenced from method com.ben.fishbein.tictacception.free.Online_home_free.onCreate
02-02 18:51:18.763: W/dalvikvm(11019): VFY: unable to resolve new-instance 457 (Lcom/google/ads/AdView;) in Lcom/ben/fishbein/tictacception/free/Online_home_free;
02-02 18:51:18.763: D/dalvikvm(11019): VFY: replacing opcode 0x22 at 0x0017
02-02 18:51:18.763: I/dalvikvm(11019): DexOpt: unable to optimize static field ref 0x0810 at 0x19 in Lcom/ben/fishbein/tictacception/free/Online_home_free;.onCreate
02-02 18:51:18.773: D/dalvikvm(11019): DexOpt: unable to opt direct call 0x0d0f at 0x1d in Lcom/ben/fishbein/tictacception/free/Online_home_free;.onCreate
02-02 18:51:18.773: D/AndroidRuntime(11019): Shutting down VM
02-02 18:51:18.773: W/dalvikvm(11019): threadid=1: thread exiting with uncaught exception (group=0x411ae438)
02-02 18:51:18.783: E/AndroidRuntime(11019): FATAL EXCEPTION: main
02-02 18:51:18.783: E/AndroidRuntime(11019): java.lang.NoClassDefFoundError: com.google.ads.AdView
02-02 18:51:18.783: E/AndroidRuntime(11019):    at com.ben.fishbein.tictacception.free.Online_home_free.onCreate(Online_home_free.java:82)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at android.app.Activity.performCreate(Activity.java:5048)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2052)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2113)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at android.app.ActivityThread.access$700(ActivityThread.java:139)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1224)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at android.os.Looper.loop(Looper.java:137)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at android.app.ActivityThread.main(ActivityThread.java:4918)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at java.lang.reflect.Method.invokeNative(Native Method)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at java.lang.reflect.Method.invoke(Method.java:511)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
02-02 18:51:18.783: E/AndroidRuntime(11019):    at dalvik.system.NativeStart.main(Native Method)



public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.free_online_home);
    bigBoard = (RelativeLayout) findViewById(R.id.rlBigBoard);

    adView = new AdView(this,  AdSize.BANNER, "aasd0");
            //new AdView(this, AdSize.BANNER, "asdsd");
//  bigBoard.addView(adView);
    //adView.loadAd(new AdRequest());

    // AdView ad = (AdView) findViewById(R.id.adView);
    //ad.loadAd(new AdRequest());
    //initialize();
}

1 个答案:

答案 0 :(得分:1)

如果GoogleAdMobAdsSdk位于您的参考库中,我的文件输入顺序错误,确保它位于您的src或res文件夹之前的顶部。