1

Please help me figure out why the commented-out lines below cause a 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);
}
P.T.
  • 24,557
  • 7
  • 64
  • 95
Vladimir
  • 157
  • 2
  • 16
  • Where is your error? It's going to be difficult debugging without that... – Wes Goodman Jun 11 '12 at 21:36
  • 06-12 02:06:39.199: W/dalvikvm(15068): VFY: unable to resolve virtual method 6580: Lcom/google/ads/AdView;.setVisibility (I)V 06-12 02:06:39.739: W/dalvikvm(15068): threadid=1: thread exiting with uncaught exception (group=0x40020560) 06-12 02:06:39.749: E/AndroidRuntime(15068): FATAL EXCEPTION: main 06-12 02:06:39.749: E/AndroidRuntime(15068): java.lang.NoClassDefFoundError: com.google.ads.AdView 06-12 02:06:39.749: E/AndroidRuntime(15068): at ru.bk.sobaka.n.e.k.GameActivity.onCreate(GameActivity.java:112) – Vladimir Jun 11 '12 at 22:10
  • full log http://www.fayloobmennik.net/1966850 – Vladimir Jun 11 '12 at 22:20
  • 1
    http://stackoverflow.com/questions/10523703/error-inflating-class-com-google-ads-adview/10525760#answer-10525760 – Eric Leichtenschlag Jun 12 '12 at 00:23

1 Answers1

0

I you must create a "libs" folder in your project root. Not "lib", "libs". And put your Admob jar there, also check if its been exported in -Properties->Build Path.

Got that error once :p

Daahrien
  • 10,190
  • 6
  • 39
  • 71