Using Admob in android development crashes the example code - android

I'm just trying to get the basics down of using Admob in my android apps, but for some reason, even the example code crashes my device and emulator. I followed the instructions on https://developers.google.com/mobile-ads-sdk/docs/ and it didn't fix my problem. As far as I can see, everything is included properly, I've added the jar file to the build path, etc etc. But for some reason, I always get errors like the following:
09-16 00:36:11.855: E/AndroidRuntime(305): FATAL EXCEPTION: main
09-16 00:36:11.855: E/AndroidRuntime(305): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.example.ads.xml/com.google.example.ads.xml.BannerSample}: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.ads.AdView
09-16 00:36:11.855: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.os.Handler.dispatchMessage(Handler.java:99)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.os.Looper.loop(Looper.java:123)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.app.ActivityThread.main(ActivityThread.java:4627)
09-16 00:36:11.855: E/AndroidRuntime(305): at java.lang.reflect.Method.invokeNative(Native Method)
09-16 00:36:11.855: E/AndroidRuntime(305): at java.lang.reflect.Method.invoke(Method.java:521)
09-16 00:36:11.855: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-16 00:36:11.855: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-16 00:36:11.855: E/AndroidRuntime(305): at dalvik.system.NativeStart.main(Native Method)
09-16 00:36:11.855: E/AndroidRuntime(305): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.ads.AdView
09-16 00:36:11.855: E/AndroidRuntime(305): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-16 00:36:11.855: E/AndroidRuntime(305): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.app.Activity.setContentView(Activity.java:1647)
09-16 00:36:11.855: E/AndroidRuntime(305): at com.google.example.ads.xml.BannerSample.onCreate(BannerSample.java:14)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-16 00:36:11.855: E/AndroidRuntime(305): ... 11 more
09-16 00:36:11.855: E/AndroidRuntime(305): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.google.example.ads.xml-2.apk]
09-16 00:36:11.855: E/AndroidRuntime(305): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
09-16 00:36:11.855: E/AndroidRuntime(305): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
09-16 00:36:11.855: E/AndroidRuntime(305): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
09-16 00:36:11.855: E/AndroidRuntime(305): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
09-16 00:36:11.855: E/AndroidRuntime(305): ... 20 more
Any help would be greatly appreciated. Thanks!

Have you put jar file in libs folder?.If Not create a new folder named libs and copy paste the jar file in it then add it to build path by right click on it and choose build path option and the add to build path.Also Do not use adview in Dialog.It may cause problem.For more help just follow the step by step guide https://developers.google.com/mobile-ads-sdk/docs/ .
Answer-
But it is good practice to put your jar file in libs folder so that it can be managed properly and I have experienced some time when if i do not put my jar in the libs folder it gives me class not found exception OK that's why I suggest you to do the same. this time you may not have any problem but most of the time It cause problem

So it looks like I glossed over a step. My Bad. I forgot to check the jar in the order/export tab.

Related

android VerifyError

i'm getting this message when i run my application i don't know why i'm getting it could any one help me. here is the logcat.
java.lang.VerifyError: com.kosh.me.Smaller
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
This happens when the build library classes conflict with those at run-time. Try performing a Clean of your project followed by a build.

Google Maps Android API v2 crashes with NoClassDefFound Error

I am trying to implement the most basic example of google maps android api v2 example.
But it crashes with the error:java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable.
I have set up the google api and have looked at stackoverflow posts like:
-https://stackoverflow.com/questions/14252879/google-maps-android-api-v2-tutorials,
-Google map android API V2 crashed
and
-https://stackoverflow.com/questions/13796822/google-map-android-api-v2-application-crashes
but their problems are slightly different than mine.
Can you please point me to the right direction? I am using android 2.2 and would like to use the new Maps to make use of fragments in my app; so that I can get some functionality like apple's uinavigation to push new views in a pop up activity.
Thanks.
Thank you,how did you get to the png you are showing in the attachment?The google play service is shown as a referenced library in my package explorer; I did add it; this is my logcat:
01-16 06:23:55.087: E/AndroidRuntime(305): FATAL EXCEPTION: main
01-16 06:23:55.087: E/AndroidRuntime(305): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
01-16 06:23:55.087: E/AndroidRuntime(305): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
01-16 06:23:55.087: E/AndroidRuntime(305): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:271)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-16 06:23:55.087: E/AndroidRuntime(305): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.app.Activity.setContentView(Activity.java:1647)
01-16 06:23:55.087: E/AndroidRuntime(305): at com.example.afis.MainActivity.onCreate(MainActivity.java:13)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.os.Looper.loop(Looper.java:123)
01-16 06:23:55.087: E/AndroidRuntime(305): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-16 06:23:55.087: E/AndroidRuntime(305): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 06:23:55.087: E/AndroidRuntime(305): at java.lang.reflect.Method.invoke(Method.java:521)
01-16 06:23:55.087: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-16 06:23:55.087: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-16 06:23:55.087: E/AndroidRuntime(305): at dalvik.system.NativeStart.main(Native Method)
01-16 06:23:55.097: W/ActivityManager(59): Force finishing activity com.example.afis/.MainActivity
01-16 06:23:55.607: W/ActivityManager(59): Activity pause timeout for HistoryRecord{44ee9110 com.example.afis/.MainActivity}
Please check if the "libs" folder containing the "android-support-v4.jar" exists in your project. Because you are using Android 2.2, you must have "libs " folder in your project root directory. If you have not that, just copy that jar file into your "libs" folder .
"android-support-v4.jar" is located in "/extras/android/compatibility/v4/android-support-v4.jar" under your drectory.
And before running your project, you must set your project Build target to "Google APIs", not Android x.x. version : Select your project and click Project > Properties > Project Build Target in Eclipse and select any "Google APIs ", and then run your project on your phone. If you use the emulator, also MUST set the AVD of the emulator to the any "Google APIs ".
Once more, you don't need to create the new Google Maps API key in order to test your project, Just use the default provided API key, which is shown as "Key for browser apps (with referers) "in your Google APIs Console.
Use Android SDK Manager download "google play services"
import it into your workspace (path: android-sdk root/extras/google/google_play_service/libproject/google-play-service_lib)
project Properties -> android -> Library add google-play-service_lib
Build path -> Order and Export check Android private libraries
I solved this error by checking "Copy projects into workspace" while importing the Google Play Services lib.
More info here: http://developer.android.com/google/play-services/setup.html

Reading contacts giving Force Close Error

I Have Tried Below tutorial For Reading Contacts In Android
http://www.edumobile.org/android/android-programming-tutorials/read-contacts-from-device/
http://eagle.phys.utk.edu/guidry/android/readContacts.html
Both Are Complete without any Error But When I Am Running It's Showing Force Close Error
I tried with API 8,13,16
Same Error For all. I Dont Know More About It But I Completly Follow Tutorial.
Catlog Here
09-30 14:02:09.121: D/AndroidRuntime(305): Shutting down VM
09-30 14:02:09.121: W/dalvikvm(305): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
09-30 14:02:09.141: E/AndroidRuntime(305): FATAL EXCEPTION: main
09-30 14:02:09.141: E/AndroidRuntime(305): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.app.ReadContacts/com.app.ReadContacts.ReadContacts}: java.lang.ClassNotFoundException: com.app.ReadContacts.ReadContacts in loader dalvik.system.PathClassLoader[/data/app/com.app.ReadContacts-2.apk]
09-30 14:02:09.141: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
09-30 14:02:09.141: E/AndroidRuntime(305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-30 14:02:09.141: E/AndroidRuntime(305): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-30 14:02:09.141: E/AndroidRuntime(305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-30 14:02:09.141: E/AndroidRuntime(305): at android.os.Handler.dispatchMessage(Handler.java:99)
09-30 14:02:09.141: E/AndroidRuntime(305): at android.os.Looper.loop(Looper.java:123)
09-30 14:02:09.141: E/AndroidRuntime(305): at android.app.ActivityThread.main(ActivityThread.java:4627)
09-30 14:02:09.141: E/AndroidRuntime(305): at java.lang.reflect.Method.invokeNative(Native Method)
09-30 14:02:09.141: E/AndroidRuntime(305): at java.lang.reflect.Method.invoke(Method.java:521)
09-30 14:02:09.141: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-30 14:02:09.141: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-30 14:02:09.141: E/AndroidRuntime(305): at dalvik.system.NativeStart.main(Native Method)
09-30 14:02:09.141: E/AndroidRuntime(305): Caused by: java.lang.ClassNotFoundException: com.app.ReadContacts.ReadContacts in loader dalvik.system.PathClassLoader[/data/app/com.app.ReadContacts-2.apk]
09-30 14:02:09.141: E/AndroidRuntime(305): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
09-30 14:02:09.141: E/AndroidRuntime(305): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
09-30 14:02:09.141: E/AndroidRuntime(305): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
09-30 14:02:09.141: E/AndroidRuntime(305): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
09-30 14:02:09.141: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
09-30 14:02:09.141: E/AndroidRuntime(305): ... 11 more
09-30 14:07:09.262: I/Process(305): Sending signal. PID: 305 SIG: 9
Have you added the com.app.ReadContacts.ReadContacts Activity to your AndroidManifest.xml?
The error you're receiving suggests that you haven't...
The line to add is probably
<activity android:name=".ReadContacts"/>
although depending on your project structure it can be necessary to use the fully qualified name
<activity android:name="com.app.ReadContacts.ReadContacts"/>
have u mentioned read contacts permission in manifest file?
<uses-permission android:name="android.permission.READ_CONTACTS" />
if yes, post the error message from log cat
It appears that the class com.app.ReadContacts.ReadContacts cannot be found. Have you specified your Activity in your AndroidManifest.xml file?

following exception in android simulator 2.0

i got following strange exception on only andorid simulator 2.0
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.markupartist.android.example.pulltorefresh/com.markupartist.android.example.pulltorefresh.PullToRefreshActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class com.markupartist.android.widget.PullToRefreshListView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.markupartist.android.widget.PullToRefreshListView
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
at android.app.Activity.setContentView(Activity.java:1647)
at com.markupartist.android.example.pulltorefresh.PullToRefreshActivity.onCreate(PullToRefresh Activity.java:21)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at com.markupartist.android.widget.PullToRefreshListView. (PullToRefreshListView.java:54)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 21 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030002
at android.content.res.Resources.getValue(Resources.java:892)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
at android.content.res.Resources.getLayout(Resources.java:731)
at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.markupartist.android.widget.PullToRefreshListView.init(PullToRefreshListView.java:80)
... 25 more
when i tested on andorid 1.6 , 2.01,2.1,2.2,2.3 ,4.0 it works completely,
is this a simulator bug of 2.0
please give me some information about this
Thanks

getting Fatal Exception caused by admob

I have an app on the market using admob and now I would like to update my app. When I test this new version I get a Fatal Exception caused by the admob.
04-06 15:09:04.123: E/AndroidRuntime(409): Caused by: android.view.InflateException: Binary XML file line #51: Error inflating class com.google.ads.AdView
04-06 15:09:04.123: E/AndroidRuntime(409): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.kmbdev.purrkitty-2.apk]
Here is the xml file with line #51:
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#id/bottom_border"
android:layout_toLeftOf="#id/right_border"
ads:adSize="BANNER"
ads:adUnitId="my id"
ads:loadAdOnCreate="true" />
I have not made any major changes from the original app that is published. I have only added a splash screen and some language strings files and changed the version to 1.2, the published app is version 1.1. I was wondering why this app will no longer run.
I have tried again, here is the log:
04-11 12:13:21.474: D/AndroidRuntime(282): Shutting down VM
04-11 12:13:21.474: W/dalvikvm(282): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-11 12:13:21.644: E/AndroidRuntime(282): FATAL EXCEPTION: main
04-11 12:13:21.644: E/AndroidRuntime(282): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kmbdev.purrkitty/com.kmbdev.purrkitty.Cat1}: android.view.InflateException: Binary XML file line #52: Error inflating class com.google.ads.AdView
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.os.Handler.dispatchMessage(Handler.java:99)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.os.Looper.loop(Looper.java:123)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-11 12:13:21.644: E/AndroidRuntime(282): at java.lang.reflect.Method.invokeNative(Native Method)
04-11 12:13:21.644: E/AndroidRuntime(282): at java.lang.reflect.Method.invoke(Method.java:521)
04-11 12:13:21.644: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-11 12:13:21.644: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-11 12:13:21.644: E/AndroidRuntime(282): at dalvik.system.NativeStart.main(Native Method)
04-11 12:13:21.644: E/AndroidRuntime(282): Caused by: android.view.InflateException: Binary XML file line #52: Error inflating class com.google.ads.AdView
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-11 12:13:21.644: E/AndroidRuntime(282): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.Activity.setContentView(Activity.java:1647)
04-11 12:13:21.644: E/AndroidRuntime(282): at com.kmbdev.purrkitty.Cat1.onCreate(Cat1.java:25)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-11 12:13:21.644: E/AndroidRuntime(282): ... 11 more
04-11 12:13:21.644: E/AndroidRuntime(282): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.kmbdev.purrkitty-2.apk]
04-11 12:13:21.644: E/AndroidRuntime(282): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-11 12:13:21.644: E/AndroidRuntime(282): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-11 12:13:21.644: E/AndroidRuntime(282): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
04-11 12:13:21.644: E/AndroidRuntime(282): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
04-11 12:13:21.644: E/AndroidRuntime(282): ... 20 more
I've got the same issue and wasted more than 3 hours to figure it out. Finally, I found the way to make it work.
change sdk name from GoogleAdMobAdsSdk-6.0.0.jar to GoogleAdMobAdsSdk.jar
create "libs" folder under project, copy above sdk in the folder and link the library using Add External JARs.
if not worked, change import class name from com.google.ads.* to com.google.ads.AdRequest, comp.google.ads.AdView, and so on.
Are you sure the manifest has all the tags? (Those of admob). Also in the XML, you need to have a addl tag for xmlns right? Did you specify it?
Clean your project, and if you don't have activated the automatic build in Eclipse, make a manual build. It will work.
To fix that problem you just have to link the sdk .jar file in two ways. First, to add it to the libs folder (if you don't have one, create it) and then, right-click on .jar file, go to Build Path->Add to Build Path... Three days to that conclusion.
I fixed it by renaming the folder in which the jar file is kept from /lib to /libs.

Categories

Resources