Google Maps crashing on Android Pie - android

I am testing Google Map on Google Pixel running the latest version of Android Pie.
Caused by java.lang.ClassNotFoundException
Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/0000000e/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/0000000e/MapsDynamite.apk!/lib/arm64-v8a, /system/lib64]]

This error occurs on Android 9.0.
Add the below code in the <application> element of manifest
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
Refer to Specify requirement for Apache HTTP Legacy library docs.

Google map is not property supported android 9+. Use the following code in your manifest file. it will work.
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />

Thanks to #Anubhav Gupta, you can also update in build.gradle:
implementation "com.google.android.gms:play-services-base:16.1.0"
But this can brake a compatibility with Android 4, see App is having trouble with Google Play Services. Please try again.

Related

How to resolve WARNING - for Google map version 1 not available in Android 11

App bundles or APKs in this release use version 1 of the Google Maps SDK, which is not available on Android 11 or higher. Remove this dependency from your app. Google Play may remove support for version 1 of the Google Maps SDK in the future.
We have already migrated to Maps API V2, hence functionality wise there should not be any issues.
I had the same issue even though we have been using latest Maps SDK for Android for years. I had to remove this entry from AndroidManifest.xml
<uses-library android:name="com.google.android.maps" />
In the app's Manifest:
Remove:
<uses-library android:name="com.google.android.maps" />
Add these lines above the <application ... />:
<!--
Android 11 package visibility changes require that apps specify which
set of other packages on the device that they can access. Since this
sample uses Google Maps, specifying the Google Maps package name is
required so that the buttons on the Map toolbar launch the Google Maps
app.
-->
<queries>
<package android:name="com.google.android.apps.maps" />
</queries>
Found those on the official Google's code sample: https://github.com/googlemaps/android-samples/blob/main/ApiDemos/java/app/src/main/AndroidManifest.xml
I'm facing the same 'problem'. But I think it's a false positive. I removed everything from v1 and used v2 for a long time now.
Probably best to create a ticket at Google for this.

Use of google map library on manifest file

Why do we use the below code on our android manifest file.Can anyone please explain?
<uses-library
android:name="com.google.android.maps"
android:required="true" />
Please check this out : uses-library. This will give the clear idea.
uses-library tells the android system that the app requires com.google.android.maps package to be installed in device ie Google maps app
if you put required attribute true, android:required="true" , then the app will be installed only if device has google maps installed in it.

Google App Invites: Google Play Services meta data tag?

In the google app invites guide (https://developers.google.com/app-invites/android/guides/app), we are asked to put the following meta-data tag in the android manifest:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
In the sample's android manifest, we cannot see this tag anywhere:
https://github.com/googlesamples/google-services/blob/master/android/appinvites/app/src/main/AndroidManifest.xml
Is there an error in the guide?
Kind of. It's obsolete. It used to be the case that you have to add that element to the manifest, but with the latest version of the Android Gradle tools, this is taken care of automatically by the Gradle plugin when you have the Google Play Services dependency.

Google MAP by Android

I am trying to Google map API.
when I run my Emulator it is show this:
what i can do??
To the edited Question
Google maps require google play services installed.
You cannot runs maps on Emulator because emulator do not have google play services apk installed.
Quoting docs
If you want to test your app on the emulator, expand the directory for
Android 4.2.2 (API 17) or a higher version, select Google APIs, and
install it. Then create a new AVD with Google APIs as the platform
target.
You require emulator of Andorid 4.2.2 or higher with google api's as the platform
Note :The below answer is to the question before the Edit. OP changed
the question completely.
You are missing a meta tag in your manifest file
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
...// rest of the code
Also you have
<uses-sdk
android:minSdkVersion="8"
So you should be using SupportMapFragment instead of MapFragment.
So change this
android:name="com.google.android.gms.maps.MapFragment"
to
android:name="com.google.android.gms.maps.SupportMapFragment"
Also extend FragmentActivity instead of Activity.
You can also get rid of the below. Not required
<permission
android:name="com.mapee.googlemapapi.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.mapee.googlemapapi.permission.MAPS_RECEIVE" />

Error on using the maps library

I am trying to run android maps example on my emulator, I have added the library
<uses-library android:name="com.google.android.maps" />
inside the application tag.
When I try to run the application in emulator I get the following error
Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
I have set the build path for android to "Google API's"
How to resolve this error?
Actually, you can't run google maps v2 on emulator.
You can check this post for a dirty solution
Right click on your project --> Properties --> Android --> On the library block clik on add and add google-play-services_lib as your project's library. Then to your manifest file add:
<permission
android:name="your_package.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="your_package.permission.MAPS_RECEIVE"/>
Then in your application tag add:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR_API_KEY"/>
If you are testing the app in emulator make sure that You have created AVD for emulator with Google Maps-APIs.
In general, this error arises from the fact that Google Maps not installed on your device/emulator.

Categories

Resources