Xamarin Android Google Maps error in Fragment - android

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

Related

Layout xml tools:targetApi not working

I use https://github.com/mattprecious/swirl/blob/master/README.md in my app.
I don't want appear SwirlView on lowwer sdk marshmallow version. because SwirlView working on version sdk marshmallow or higher version.
so I add "tools:targetApi='M'" to SwirlView xml node. look at the code below.
<com.mattprecious.swirl.SwirlView
android:id="#+id/fingerprint_SwirlView"
android:layout_width="100dp"
android:layout_height="100dp"
tools:targetApi="M"/>
but when I run app on lolipop version. occure error like this.
android.view.InflateException: Binary XML file line #29: Error inflating class com.mattprecious.swirl.SwirlView
what is problem with my code.
sorry for my poor english skill.
You gotta override the xml instead of suppressing the error. Tools don't affect the app, only Android Studio.

R file for custom component not compiling

I have two custom components, one which I made quite recently, both in Android Studio. The earlier one worked. I followed the same procedure to make the new one but it throws runtime errors when I reach the activity screen during testing.
These are the exception messages, listed in order:
1. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sentient/com.mycompany.MyActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class <unknown>
2. Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class <unknown>
3. java.lang.reflect.InvocationTargetException
4. java.lang.NoClassDefFoundError: com.mycomponent.R$color
Error #4 shows the actual line itself that throws the error, it is part of the constructor of the component:
int color = res.getColor(R.color.progress_gray);
I checked the R file manually, and found the colors (progress_gray is defined in the colors.xml) to be present. I removed the line, and another line throws the error instead (which again depends on the R file to get information).
I have tried cleaning, changing build order in gradle, Make the component separately, and I still can't figure out where the mistake is. Any help is appreciated! Thanks.
can you post the xml file of the custom view?
Check if you have added to your main layout of the custom view xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
I got the solution. The applicationId in build.gradle and the package in the manifest were not matching. Once I changed it, it worked.
Strange though, I had thought that the reason the two were separated was so that they could be named differently. In any case, that was what got it working.

Android - problems with new AdMob implementation

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.

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