I was developing an application on API 9, 2.3.3 then I changed the build to 4.0.3 because I only had 4.0.3 installed other than 2.3.3 and 2.2 due to admob's policy.
I have tried to embed admob into my Android application but have been failing ever since. I finally did it on my school computer and it works perfectly. However, I imported my project into my own laptop, trying to edit and add on more coding and lots of problems started to arise without even editing any part of the code.
What I know is that my school PCs are using eclipse indigo and I am using juno. Is it because I did not import my codes properly or it is my eclipse version or something else? Here's the dummy code I did.
MainActivity.Java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
XML
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="the right code"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>
Manifest
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
So there is it. I have looked into many sites for help but to no avail.
When you move a project in between computers you have to re-import things (because their file path's have changed). Try looking in your imports and seeing if the SDK is still imported.
Whether it is or not, if you are using ADT tools r-17
and up then you have to create a libs/
folder in you main directory, and put a copy of the adMob SDK in there.
Hope this solves your problem