[Other Tools & General Discussion] chintz24:
Guys,I am trying to integrate admob SDK in my app from the past 3 hours and have no luck.

I have added the jar libraries ( build path), included in build paths, everything is good there.

main activity :

// Create the adView
adView = new AdView(this, AdSize.BANNER, MY_AD_UNIT_ID);

// Lookup your LinearLayout assuming it's been given
// the attribute android:id="@+id/mainLayout"
RelativeLayout layout = (RelativeLayout)findViewById(R.id.ad);

// Add the adView to it
layout.addView(adView);

// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());

layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<com.google.ads.AdView
android:id="@+id/ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
ads:adSize="BANNER"
ads:adUnitId="a15XZXXXXX3"
ads:loadAdOnCreate="true" />

everything loaded on the manifest file as well!

LOGCAT :

07-09 15:33:20.362: D/dalvikvm(12621): GC_CONCURRENT freed 188K, 3% free 8916K/9132K, paused 5ms+8ms, total 46ms
07-09 15:33:20.362: E/AndroidRuntime(12621): FATAL EXCEPTION: main
07-09 15:33:20.362: E/AndroidRuntime(12621): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.PACKAGE/com.PACKAGE.MainActivity}: java.lang.NullPointerException
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.os.Handler.dispatchMessage(Handler.java:99)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.os.Looper.loop(Looper.java:137)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.app.ActivityThread.main(ActivityThread.java:5041)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at java.lang.reflect.Method.invokeNative(Native Method)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at java.lang.reflect.Method.invoke(Method.java:511)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at dalvik.system.NativeStart.main(Native Method)
07-09 15:33:20.362: E/AndroidRuntime(12621): Caused by: java.lang.NullPointerException
07-09 15:33:20.362: E/AndroidRuntime(12621):	at com.PACKAGE.MainActivity.onCreate(MainActivity.java:42)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.app.Activity.performCreate(Activity.java:5104)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
07-09 15:33:20.362: E/AndroidRuntime(12621):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
07-09 15:33:20.362: E/AndroidRuntime(12621):	... 11 more
07-09 15:33:22.877: I/Process(12621): Sending signal. PID: 12621 SIG: 9