Reputation: 3
I'm using Android Studio. I have added the googleAdMobAdsdk6-4-1.jar to the project in my previously added libs folder. I can expand the library file and actually navigate to the AdView class. It compiles with no problem but when I run it It crashes. Any assistance appreciated.
12-15 21:35:40.581 5375-5375/? E/dalvikvm﹕ Could not find class 'com.google.android.gms.ads.AdView', referenced from method net.kritico.todolist.ToDoListActivity.onCreate
12-15 21:35:40.581 5375-5375/? W/dalvikvm﹕ VFY: unable to resolve new-instance 996 (Lcom/google/android/gms/ads/AdView;) in Lnet/kritico/todolist/ToDoListActivity;
12-15 21:35:40.581 5375-5375/? D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0037
12-15 21:35:40.585 5375-5375/? D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2034 at 0x39 in Lnet/kritico/todolist/ToDoListActivity;.onCreate
12-15 21:35:40.585 5375-5375/? I/dalvikvm﹕ DexOpt: unable to optimize static field ref 0x0b0b at 0x47 in Lnet/kritico/todolist/ToDoListActivity;.onCreate
12-15 21:35:40.585 5375-5375/? D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2031 at 0x5c in Lnet/kritico/todolist/ToDoListActivity;.onCreate
12-15 21:35:40.597 5375-5375/? I/dalvikvm﹕ DexOpt: unable to optimize static field ref 0x0b0a at 0x5f in Lnet/kritico/todolist/ToDoListActivity;.onCreate
12-15 21:35:40.765 5375-5375/? D/AndroidRuntime﹕ Shutting down VM
12-15 21:35:40.765 5375-5375/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa617b908)
12-15 21:35:40.789 5375-5375/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.kritico.todolist/net.kritico.todolist.ToDoListActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
Upvotes: 0
Views: 10728
Reputation: 1145
I'm using react-native-admob-next and seriously I face lot of problems in implementaion
i do just :-
just add some lines
dependencies {
//noinspection GradleDynamicVersion
// implementation 'com.intellij:annotations:+@jar'
// implementation 'com.google.android.gms:play-services-ads:20.2.0'
implementation 'com.facebook.react:react-native:+'
implementation('com.google.android.gms:play-services-ads:+')
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.ads.mediation:facebook:+'
}
Upvotes: 1
Reputation: 668
Use this latest library:
implementation 'com.google.android.gms:play-services-ads:19.3.0'
And feel free to read the admob documentation.
Upvotes: 1
Reputation: 33408
Remove the jar from your libs folder (That sdk is now deprecated). You should use Google play services.
After removing the jar. Clean your project and add the following under dependencies
in your app level build.gradle
.
compile 'com.google.android.gms:play-services-ads:8.4.0'
Sync your project as prompted after which you should be good to go.
Upvotes: 1
Reputation: 20196
Your XML references com.google.android.gms.ads.AdView (see stacktrace) which is contained in the Google Play Services library and is how Admob is now packaged.
But your have included Admob-6.4.1 whcih is the old Admob SDK and the Admob classes there are in a different package and have slightly different signatures.
Remove Admob-6.4.1 from your project and use Google play Services instead.
See https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals#play
Upvotes: 1