Android - problems with new AdMob implementation - android

I am trying to replace old adMob implementation with the new Google Play Services AdMob version.
Unfortunately on some devices (with Android 4.0, 4.1) get following error:
*FATAL EXCEPTION: main
E/AndroidRuntime(5280): java.lang.RuntimeException: Unable to start activity ComponentInfo: android.view.InflateException: Binary XML file line #14: **Error inflating class com.google.ads.AdView***
As you see, the problem is with com.google.ads.AdView but I am replaced this with com.google.android.gms.ads then no more using this old ads library mentioned in this error. I am sure that all code is replaced with the new gms library properties (in Manifest, XML, imports and invoking method).
Due my tests even removed all ads and libraries calls from my app but the problem still exist.
This app (and new ads) working properly on some devices (with Android 2.3.5 and 4.4.3) and in emulators but not working on devices with Android 4.0 or 4.1.
I am using Eclipse.
Thank you for any help.

With Google Play Services, the package name of the Ad classes have changed. Instead of com.google.ads, it's now com.google.android.gms.ads.
So if you change this in your layout, it should work.

Related

Xamarin Android Google Maps error in Fragment

I'm getting an error while displaying maps in a fragment, I've been searching for the solution and Tried several codes but nothing seems to work.
MainActivity.xml
StackTrace: {Android.Views.InflateException: Binary XML file line #1: Binary XML file line #2: Error inflating class fragment --->
Android.Views.InflateException: Binary XML file line #2: Error inflating class fragment --->
Java.Lang.RuntimeException: API key not found.
Check that
is in the element of AndroidManifest.xml
it says API Key not found, but i did declared it in manifest and validated it using http://yougapi.com/tools/google-api-key-checker.php
AndroidManifest.xml
activity_main.xml
PS: Im using android 9.0 physical device for debugging
Please make sure if you have install Xamarin.GooglePlayServices.Maps package from NuGet.
And you used Android 9.0 physical device, please make sure your device if have Google Play services
I test my demo in the Android 10.0 emulator, it worked as normal.
Here is my demo. You can test it.
https://github.com/851265601/XAndroidMap

Exoplayer2 throwing error inflating class com.google.android.exoplayer2.ui.PlayerView on many Vivo devices

My exoplayer2 is working fine in devices like Samsung, Motorola, Xiomi, sony etc on both release and debug build.
But when I have released my app on play store, it is throwing error on devices like nexus 4(Android version 6.0.1) and some Vivo models like Vivo Y53, Y71, and V5 having android version 6.0.1, 7 and 8.
Crashlytics showing this error : Caused by android.view.InflateException: Binary XML file line #153: Error inflating class com.google.android.exoplayer2.ui.PlayerView
My code already contains properties mentioned in Error inflating class com.google.android.exoplayer2.ui.SimpleExoPlayerView but still facing issue in few devices.
Can it be because of custom ROM in Vivo and Nexus devices?
Found solution for this, it was not any development error because if it would have been any code error, then it should have occurred on multiple devices.
So, my last resort was to rectify what exactly is happening. As the app's apk was uploaded as a bundle, then if the user was installing the app after sharing the bundle apk (sideloading) by ShareIt or Whatsapp, it was getting crash, because it is app bundle's property that we cannot share the APK generated from bundle.
So, to check that if user is installing the app through sideloading, we can add google's play core library to let them know that the "app is missing components. Please install from playstore".
Gradle:
implementation 'com.google.android.play:core:1.6.3'
Application Class in onCreate():
if (MissingSplitsManagerFactory.create(this)
.disableAppIfMissingRequiredSplits()) {
return;
// Skip app initialization.
}
As per the Documentation, please add below lines in build.gradle(Module:app)
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
}
Hope this helps.

Google AdMob TBannerAd LoadAd exception after upgrading to Delphi v10.2.3

My application was originally written using Delphi v10.2.2 and TBannerAd worked just fine.
Without any code changes and after upgrading Delphi to v10.2.3 (by installing over the existing v10.2.2 using the ISO without changing anything in the installation dialogs), calling TBannerAd's "LoadAd" method started triggering this exception:
Project myproject.apk raised exception class EJNIException with message
'java.lang.IllegalStateException: The meta-data tag in your app's
AndroidManifest.xml does not have the right value. Expected 4323000
but found 7095000. You must have the following declaration within the
< application > element: < meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" / >'.
I reviewed the AndroidManifest.xml file and indeed the "7095000" value is used, but I don't know why/how delphi uses this value. Rebuilding the project generates a new AndroidManifest.xml file with the "7095000" value, so I can't directly edit the XML file as a work-around.
What causes this? Is it some setting or SDK path that changed due to the upgrade? (I tried searching but couldn't find anything relevant)
Things I tried:
Completely uninstalling the application and running it again from Delphi (on a real device, a Galaxy note 4).
Under options, changing the NDK API location and C++ Builder NSK Library paths from "\platforms\android-14" to "\platforms\android-19".
Tokyo 10.2.3 has updated Google Play Services and its libraries.
Applications created with old version don't automatically update the libraries to new ones shipped with 10.2.3 release.
To update the libraries go to Project Manager -> Android -> Android SDK xxx -> Libraries and select "Revert System Files to Default" from the popup menu.
After reverting list of included libraries should be

AdMob add not display Ad in Android App with AndEngine

I have followed all the steps for adding an AdMob Ad into my app from the link at
http://www.wikihow.com/Add-Advertisements-to-Your-Android-Applications-Using-Admob
But when I run my App it does not display the Ad. My app uses AndEngine and hence the target =android-17 as opposed to android-13 specified in the link which causes compilation errors. I added the method onCreateBundle() and wanted to test AdMob. But I get this error in logCat
in my activity_main.xml for with the message
"Error inflating class com.google.ads.Adview. I can see that the jar file has been added to the build path.
Can you please let me know what I am doing wrong. I added the code more than 12 hours back and yet there is no display.
The problems was fixed by by clicking Project->Propoerties->Build Path-> Order & Export and then building. See
Error inflating class com.google.ads.AdView

Android: there's no way i can install admob on my app

I begin to get angry, there's no way I can put admob in my app.
I have a 2.3.3 app with min-sdk="10" I need it for zxing.
now I need to put admob... I go in my account to download it (version 6.0.1), and i found that android 3.2 is needed!
I've tried various implementation, such as put admob4, varios code, but i had no success...
how can i install admob and let 2.3.3? how can make this terrible thing work?
logcat:
07-10 13:55:20.007: E/AndroidRuntime(1348): java.lang.RuntimeException: Unable to start activity ComponentInfo{it.mi.action.codmmunicator_2ddecoder/it.mi.action.codmmunicator_2ddecoder.Tabs}: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.ads.AdView
Here you can see how you can add admob into your app. You simply have to work with the 3.2 or 4 android sdk but in your manifest min-sdk tag you put 10 ... For more details please take a look at that tutorial.

Categories

Resources