首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >横幅广告崩溃android ap

横幅广告崩溃android ap
EN

Stack Overflow用户
提问于 2013-02-03 08:35:22
回答 1查看 360关注 0票数 0

出于某种原因,这行代码

代码语言:javascript
复制
adView = new AdView(this, AdSize.BANNER, "xxxxxx");//adUnitId is actually there

每当我尝试运行我的android应用程序时,它都会崩溃。

我放入了GoogleAdMod jar文件,但没有得到任何结果

project.properties

代码语言:javascript
复制
target=android-16

AndroidManifest

代码语言:javascript
复制
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

我一直在做这件事,并尝试了通过xml和类的方法,但我被难住了。

提前感谢

-Ben

编辑:日志

代码语言:javascript
复制
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();
}
EN

回答 1

Stack Overflow用户

发布于 2013-02-03 10:09:59

我把我的文件的顺序弄错了,如果GoogleAdMobAdsSdk在你的引用库中,请确保它在你的src或res文件夹之前的顶部。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14668209

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档