I am trying to get AdMob to work on my app with Eclipse. For that I already implemented following steps:
Signed up on AdMob and created an ad
Inserted following to Manifest.xml:
<!-- This meta-data tag is required to use Google Play Services. --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"android:theme="@android:style/Theme.Translucent" />
Installed and imported
google-play-services_lib
(checked copy files into workspace)Added
google-play-services_lib
as library to projectIn my layout xml I have this:
<com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="ca-app-pub-2756687115022088/XXXXXXXXXX" > </com.google.android.gms.ads.AdView>
Also I included xmlns:ads="http://schemas.android.com/apk/res-auto"
6.Added following to my Activity:
import android.app.Activity;
import android.os.Bundle;
import com.example.adexample.R;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
}
7.Now when I try to run the app on my device I always get following error:
unable to execute dex gc overhead limit exceeded
What I tried, but no success: increase memory size in eclipse.ini and sometimes Eclipse doesn't start and I have to do following step: https://stackoverflow.com/a/18282716/3829021