1

请帮我弄清楚为什么下面注释掉的行会导致NoClassDefFoundError

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);             
    RelativeLayout layout = new RelativeLayout(this);  
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

    View gameView = initializeForView(new GraphicsView(), false);
    // ERROR comes from these lines:
    // AdView adView = new AdView(this, AdSize.BANNER, "a14fd65977f0c9f");
    // adView.loadAd(new AdRequest());

    RelativeLayout.LayoutParams adParams = 
            new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 
                            RelativeLayout.LayoutParams.WRAP_CONTENT);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

    layout.addView(gameView);
    setContentView(layout);
}
4

1 回答 1

0

我必须在项目根目录中创建一个“libs”文件夹。不是“lib”、“libs”。并将您的 Admob jar 放在那里,并检查它是否已在 -Properties->Build Path 中导出。

一次得到那个错误:p

于 2013-05-29T00:16:28.487 回答