Add Google Maps to my app - android

I am trying to add google maps to my android application, and I followed this documentation: https://developers.google.com/maps/documentation/android/start
First off, is my Manifest file correct?
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="where.is.the.action"
android:versionCode="1"
android:versionName="1.0">
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="where.is.the.action.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="where.is.the.action.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<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>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
</application>
</manifest>
Then here is my layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="My Location"
android:onClick="getLocation"
android:layout_weight="0"
/>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
</LinearLayout>
It works fine if I remove the fragment tag, but once I add it back in the app closes and displays: "Unfortunately, MainActivity has stopped."
Does anyone see what is wrong?

Perhaps you are trying to use MapFragment on a device that is not running Android 3.0+. MapFragment is for use with an Activity and the native fragment implementation from API Level 11. SupportMapFragment is for use with a FragmentActivity and the fragment backport supplied by the Android Support Library.
UPDATE
Upon further review, the problem is probably two-fold:
You attempted to attach google-play-services.jar to your project, instead of following the instructions and attaching the Play Services Android library project to your project.
You did #1 above by messing with your build path directly, instead of copying the JAR to libs/.
Undo what you did originally. Then, follow the instructions to attach the Android library project to your project (which, as a side effect, will properly set up that JAR for you).
Since it appears that you are doing a command-line build, you will need to create the command-line build files for the Android library project, which Google elected not to ship (grrrrrrrrrrrrrrr). Run:
android update project -p /home/ryan/android-sdk-linux/extras/google/google_play_services/libproject/googl‌​e-play-services_lib
to create the necessary files.

Related

Why are my android manifest not merging?

So I've an Android lib that I made, that library has an activity a service and some permissions declared in the lib manifest.
I also have a demo app which uses the lib jar. So what I want to do is to use that lib on that demo app or any other app without having to declare the activity, the service and if possible the permissions each time I use the lib.
If I don't declare the activity, the service and the permissions in the demo app my demo app crashes on runtime. As far as I know; Android merges the manifests but I don't thinks that its doing it.
Here is my lib manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mylib">
<!-- This app records A/V content from camera and stores it to disk -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application>
<activity android:theme="#style/Transparent"
android:name="org.mylib.activities.CheckStoragePermissionsActivity"/>
<service android:theme="#style/Transparent" android:name="org.mylib.services.BackgroundVideoRecorder"/>
</application>
</manifest>
and here is my demo app manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mx.mydemo">
<application
android:name=".App"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".activity.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.RegisterUserActivity" />
<activity android:name=".activity.LogGameDataActivity" />
<activity android:name=".activity.GameResultsActivity" />
<activity android:name=".activity.PasswordResetActivity" />
</application>
</manifest>
Is there something wrong in any of my manifest that is not allowing them to be merged? Does the lib manifest package and the demo app manifest package needs to be the same package?
Greetings
By the way the lib and the demo app are 2 different and separate projects I'am pasting the lib jar in the demo lib folder and then I'm telling android studio to import the jar as a library.
That is not going to work. The JAR is just Java code; it does not contain the manifest, resources, or assets from the library module.
Either:
Move these into one project as separate modules, then use compile project() syntax in the demo project to pull in the library module, or
Publish the library module as an AAR to an artifact repository (a local one on your development machine, Maven Central, JCenter, whatever), and have the demo app pull it in from there, or
Copy the AAR, not the JAR, from the library project into the demo project
I strongly recommend either of the first two options.

Add Google Maps to Android app

I need help adding Google Maps to my Android app. I have followed the instructions on
https://developers.google.com/maps/documentation/android/start, but I still get an error when running the app.
This my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.image.app" android:versionCode="1" android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".map" android:label="#string/app_name"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBHPmNLCVvmVSCNTWYvhMUB65f1dwqSG5Y" />
</application>
<permission android:name="com.image.app.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.image.app.permission.MAPS_RECEIVE" />
<!-- Access Internet -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- Take picture -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- GET Latitude Longitude -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000"
android:required="true" />
This is my main class:
import android.app.Activity;
import android.os.Bundle;
public class map extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
}
}
This is my xml:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map" android:layout_width="match_parent"
android:layout_height="match_parent" android:name="com.google.android.gms.maps.MapFragment" />
Go to windows. Android sdk manager. Scroll down choose google play services under extras and install
Copy the google-play services_lib library project to your workspace. The library project can be found under the following path.
<android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project .
Click File > Import, select Android > Existing Android Code into Workspace, and browse the workspace import the library project.
To check if its a library project. Right click got properties choose android. You see Is Library checked as below.
Next refer the library project in your android map project.
Right click on your android map project goto properties. choose android. click add browse the library project and click add and apply.
Make sure your api is 12 and above. If not you should use support fragment which requires support library.

Google Maps V2 - Error inflating class Fragment

I'm trying my hand and Android Application Development. I'm currently using Eclipse (I can't remember the version, whatever the newest is). I've crossed a bridge where I just can't seem to grasp what I'm doing wrong. I'm attempting to use the Google Maps V2 API. I've been through several documents and tried several techniques, all of which lead to the same error:
Android.view.Inflate Exception: Binary XML file line #2: Error inflating class fragment
I've been pounding my face into the keys for 2 days straight trying to grasp what I'm doing wrong here.
Things I've done:
Started with a blank activity.
Project -> Properties -> Android -> Project Build Target is Google APIs - 4.2 - API 17 - I've tried every other option as well (as long as above version 3.0, found it documented
Added the google-play-services_lib to my Package Explorer. I indicated that the google-play-services_lib was indeed a library.
Project -> Properties -> Android -> Library -> Add -> and I choose the location to the google-play-services_lib.
Included android-support-v4.jar as a dependency of my project.
I've tried so many different answers from questions similar to mine, but to no avail. :(
I can usually figure these things out, but maybe I'm just too overloaded.
My package explorer tree in eclipse looks like
google-play-services_lib
Svma
Here's the code:>
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testing.svma"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<permission
android:name="com.testing.svma.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.testing.svma.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.testing.svma.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="SHA1_Generated_KEY_HERE" />
</application>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
</manifest>
MainActivity.java
package com.testing.svma;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Reference Documents
I used “Error inflating class fragment” with google map to try and fix my issues.
I referenced This google maps quick start guide to create my project.
I had started initially with the sample code from the Introduction to the Google Maps Android V2 Api
A whole slew of SO questions.
So, SO Community, what am I doing wrong? Why am I unable to grasp this simple concept.
Thank you in advance.
I know this is probably a dead thread but just in case someone stumbles upon here having an identical problem - your manifest might be missing the following meta information:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Declare it within the <application> element and your code should work. I ran into the same issue following a youtube tutorial that skipped this step and only when carefully going through the original Google tutorial I noticed the missing code.
Anyway, hope this helps someone.
I have the same code/same problem! Try adding android:name="com.testing.svma.MainActivity" to "fragment" in the layout! It solved the issue for me
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
android:name="com.testing.svma.MainActivity"/>
I had the same problem, solved it by modifying the Manifest.
This is my manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="example.gps"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="example.gps.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<!-- Copied from Google Maps Library/AndroidManifest.xml. -->
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<!-- End of copy. -->
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<YOUR VALUE>"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="example.gps.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>
</manifest>
And the xml file is
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
/>
The java class is
public class MainActivity extends FragmentActivity
{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
That solved my problem
Try to add google-play-services library reference to your project. If you are using Eclipse, you need to go to Project->Properties->Android and Add google-play-services library project.
ALTERNATIVELY,
You can modify project.properties file manually.
Try to add reference to your google_play_services library. So my project.properties file looks like:
# Project target.
target=android-17
android.library.reference.1=../../../android-sdks/extras/google/google_play_services/libproject/google-play-services_lib
In your case path to google-play-services lib may be different
I tried to import your code and it crashed as well. When I modified properties file - I've got map running
I spend a lot of time trying to solve this problem and after much reading and trying, I solved by changing the
public class MainActivity extends FragmentActivity
for this
public class MainActivity extends android.support.v4.app.FragmentActivity
I hope this can help you
Had tried all the above answers over a period of a couple of days and then eventually this worked:
Project -> Properties -> Android -> Project Build Target
Changed the project build target to android 4.3(API 18) and clicked apply
In the manifest I then manually changed the min and target sdk versions:
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
This now matches the target=android-18 in the project.properties file (which resulted from the project build target change we did first)
I also tried android:minSdkVersion="11" which worked so the targetSdkVersionis the important bit.
Hope this helps someone!
I had the same problem and I did the mistake to only add one of the 2 following tags.
The actual error is really misleading, as you might be thinking of some API level UI issue.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<YOUR VALUE>"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Note that you are also missing one of these two
Frequently the problem is in Manifest.xml , so be sure that you write the right permissions like :
`
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zako.android.locationapi.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<permission
android:name="com.zako.android.locationapi.maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- Requires OpenGL ES version 2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.zako.android.locationapi.maps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.zako.android.locationapi.maps.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="......" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
`
don't forget <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
and <meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
I had a similar error and I think it comes from this point: when I include the Google Play Service API I do not copy it in my workspace, I use the original one !!!
Note: You should be referencing a copy of the library that you copied to your source tree—you should not reference the library from the Android SDK directory.
Check this point.
I have got similar problem that I resolved by right click project->tools>add support library ...
and setup library
I hope this help you
Just include the following line of code on onDestroy()
SupportMapFragment mapFragment = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map_location_sharing));
if(mapFragment != null) {
FragmentManager fM = getFragmentManager();
fM.beginTransaction().remove(mapFragment).commit();
It worked for me.Hopefully gonna work for you too. Thanks
I had this error too and it was due to EXTERNAL PERMISSIONS. It has no sense but I added this permission and since then everything worked fine.
In Some of android 6.0 mobile this exception is bug
If unable to flat XML cause by
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Configuration android.content.res.Resources.getConfiguration()' on a null object reference
Then it is active bug in android
https://issuetracker.google.com/issues/35827842
This can be solved by adding
android:hardwareAccelerated="true" adding in activity tag
using both meta data references was resolving the issue in my case:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="yourAPIkeyFromGoogleAPIConsole" />
I simply added API key to manifest and it helped
I was facing the same problem I just added the API_KEY to Manifest and every thing is fine.
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/map_api_key" />

Google Maps APIv2: Failed to find provider info for com.google.settings. Api key and internet permission are set

I want to display Google Map APIv2 in an emulator.
It seems to me that I've done everything according to official Google tutorial and this tutorial. I see "+" and "-" buttons to adjust zoom, but don't see the map.
I've tried to regenerate keystore and provide another api key, but this had no effect. The only guess I have is that eclipse signs my application with a debug key, though I've done export procedure from my keystore.
Or may be it's somehow jdk issue? I have jdk 1.7 installed, and android uses 1.6
Here are the errors that I get:
E/Trace(681): error opening trace file: No such file or directory (2)
E/ActivityThread(681): Failed to find provider info for com.google.settings
E/ActivityThread(681): Failed to find provider info for com.google.settings
E/ActivityThread(681): Failed to find provider info for com.google.android.gsf.gservices
E/ActivityThread(681): Failed to find provider info for com.google.android.gsf.gservices
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="us.irz.findme"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="17" />
<permission
android:name="us.irz.findme.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="us.irz.findme.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="us.irz.findme.LoginActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="us.irz.findme.DeviceActivity"></activity>
<activity android:name="us.irz.findme.MapActivity"></activity>
<activity android:name="us.irz.findme.TabsActivity"></activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my_api_key"/>
</application>
</manifest>
map.xml file
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
MainActivity.java
public class MainActivity extends FragmentActivity implements OnClickListener {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
}
...
}
If you like to try it in a emulator, the emulator has to be created as with target Google Api level xx, not with Android 2.3 (for example), Sometimes the emulator can't load the map, so I recomended you to use a real Android device, your phone, tablet or something like this... Too check that the api key is the correct.. If you know spanish, can follow this tuto, is very good http://www.sgoliver.net/blog/?page_id=3011, search the section "Mapas en Android (Google Maps Android API v2) – I"...
Please check that you added the Google Play Services library in you project.

yet another INSTALL_FAILED_MISSING_SHARED_LIBRARY when using Google Maps on Android

I went through all the articles about the INSTALL_FAILED_MISSING_SHARED_LIBRARY issue in Google Maps projects but I couldn't find a case similar to mine nor a solution, so here is my problem:
I have a project with an activity (com.example.googleMaps.AndroidGoogleMapsActivity) that inherits from MapView to show a Google Map and do some stuff.
I run it on a Samsung Galaxy S II and it works fine: it shows the map and does the stuff it is supposed to do.
Now.
I want to use this project as a library for another project and show that activity as the first screen of another app.
So I checked the box Is Library, I created a new android project that builds against GoogleAPI and includes the library in the Android properties in Eclipse with the following manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<uses-library android:name="com.example.googleMaps" required="true" />
<uses-library android:name="com.google.android.maps" required="true" />
<activity android:name="com.example.googleMaps.AndroidGoogleMapsActivity"
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>
</manifest>
I run this new project on my device and I get the infamous error:
INSTALL_FAILED_MISSING_SHARED_LIBRARY
and LogCat is totally silent.
I would like to point out that the activity inside the library works so none of the well know issues should apply.
In the client project I specify two uses-library tags (one for my library and one for the Google library), I build against GoogleAPI, include the library in the Android properties in Eclipse and run on a tested device.
Am I still missing something?
I had the same problem, just remove the line:
<uses-library android:name="com.example.googleMaps" required="true" />
and it should work.
Only Use com.google.android.maps. Please remove another one.

Categories

Resources