1
votes

I was trying add admob banner in a application. I downloaded all updates for Eclipse and SDK.

Also in the manifest I

1)Add a meta-data tag;

2)Declare com.google.android.gms.ads.AdActivity;

3)Set up network permissions.

Add the Google Play services library project I also didnt forgot

This is xml code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000" >

<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    ads:adSize="BANNER"
    ads:adUnitId="ca-app-pub-98743015.........." />

I think the problem is in xml because there is a The following classes could not be instantiated: but despite the problems the application works

This is code in activity

import com.google.android.gms.ads.AdRequest;

import com.google.android.gms.ads.AdView;

and in onCreate:

AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);

and finally we got to logcat The Google Play services resources were not found. Check your project configuration to ensure to the resources are included. This problems appears three times in a row.

If the program is long used they are crashed and in logcat

07-22 16:20:57.507: E/AndroidRuntime(26225): FATAL EXCEPTION: main
07-22 16:20:57.507: E/AndroidRuntime(26225): android.content.ActivityNotFoundException:                           Unable to find explicit activity class {com.svyART.idd/com.svyART.idd.Nakleyki}; have you          declared this activity in your AndroidManifest.xml?
07-22 16:20:57.507: E/AndroidRuntime(26225):    at     android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1756)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at   android.app.Instrumentation.execStartActivity(Instrumentation.java:1555)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at   android.app.Activity.startActivityForResult(Activity.java:3431)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at     android.app.Activity.startActivityForResult(Activity.java:3392)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.app.Activity.startActivity(Activity.java:3627)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.app.Activity.startActivity(Activity.java:3595)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at com.svyART.idd.Idn$1.onItemClick(Idn.java:458)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.widget.AdapterView.performItemClick(AdapterView.java:298)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.widget.AbsListView.performItemClick(AbsListView.java:1223)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.widget.ListView.performItemClick(ListView.java:4506)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.widget.AbsListView$PerformClick.run(AbsListView.java:2967)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.widget.AbsListView$1.run(AbsListView.java:3653)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.os.Handler.handleCallback(Handler.java:725)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.os.Handler.dispatchMessage(Handler.java:92)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.os.Looper.loop(Looper.java:158)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at android.app.ActivityThread.main(ActivityThread.java:5751)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at java.lang.reflect.Method.invokeNative(Native Method)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at java.lang.reflect.Method.invoke(Method.java:511)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
07-22 16:20:57.507: E/AndroidRuntime(26225):    at  dalvik.system.NativeStart.main(Native Method)

I would be very grateful for your help

3

3 Answers

1
votes

You have to add the google-play-services-lib as a library-project. Open the SDK Manager and check it on the list to be downloaded. Then you'll find it into android-sdk-x/extras/google_play_services/libproject

Then from Eclipse, right-click your project, go to Properties and add the .jar.

1
votes

Your stackltrace is very clear about why it is failing.

07-22 16:20:57.507: E/AndroidRuntime(26225): android.content.ActivityNotFoundException:                           Unable to find explicit activity class {com.svyART.idd/com.svyART.idd.Nakleyki}; have you          declared this activity in your AndroidManifest.xml?

It is trying to start an Activity called com.svyART.idd.Nakleyki when a ListView item is clicked, but the Activity is not declared in your AndroidManifest. Add it to AndroidManifest.

0
votes

The error message:

The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

can be safely ignored as stated in the Google Mobile Ads SDK FAQ.

Don't ask me why Google Play Services write some much confusing stuff to the log and why Google is unable to fix it. The problem isn't exactly new.