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.
Related
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.
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.
After much looking around SO and other places and not being able to fix my problem I will now create a new post in the hopes of getting my problem resolved.
I am putting together a test app to obtain a location using Google play services and seem to have everything in place - including the permissions. When the test app is run via the emulator,, an error stating that the client must have ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permissions. Below is a piece of the stack trace.
11-19 16:34:40.403: E/AndroidRuntime(1245): Caused by: java.lang.SecurityException: Client must
have ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to perform any location
operations.
And here is part of AndroidManifest.xml
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_COURSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
What else? I am using the Google APIs platform 5, api 21 for my build target and have the google-play-services... library added to the project. I have also set-up mock latitude and longitude values on the DDMS' Emulator Control tab.
Is there anything else that needs to be put in place to get this to work? Can this be run from the emulator? For what it is worth, the project being worked with is the LocationUpdates project that was downloaded from Google.
If you need additional information to help point me in the right direction please let me know.
Thank you.
I'm not sure why you get permission errors even though your permissions are in the manifest file but I can already tell you that Google Play Services won't work on the emulator unless you're using Google API
See here
To develop an app using the Google Play services APIs, you need to set up your project with the Google Play services SDK. If you haven't installed the Google Play services SDK yet, go get it now by following the guide to Adding SDK Packages.
To test your app when using the Google Play services SDK, you must use either:
A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.
EDIT:
Oh wow, I have just noticed that this post is already quite old. If that's a problem someone please tell me or delete the post
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" />
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.