How can I create an Android application in Android Studio that uses the Google Maps Api v2?
2013-05-22 23:29
405 查看
1) I took
from the Google Play Services samples and copied that to the separate directory. That is going to be our MapsApiV2 project we will be trying to run. On my Mac it was located at
placed it to the
2) Copied
directory to the same place (
so my working directory looks like this. Btw, lib project is located at
3) Now let's open Android Studio. On welcome screen press
from
Now we see a lot of complaints about unknown reference to GMS library:
4) Now we need to add Google Play Service as a reference library. Going to
5) On the
click
and select
the way to the end:
6) Now you need to reference this imported library. Open this screen again (go to
and
selected. Click
add a dependency and select
Choose your imported library there:
7) Now we can see that it is not complaining about
but still complaining about support library:
8) Let's fix it. I have my support library
located at
Select
select support library:
9) Now it is going to ask you which
project to add this lib to, so make sure you have selected your
10) At this point code should compile w/o problems. Just make sure you are targeting the right SDK version in Manifest.
转载地址:http://stackoverflow.com/questions/16596715/how-can-i-create-an-android-application-in-android-studio-that-uses-the-google-m?rq=1
mapsproject
from the Google Play Services samples and copied that to the separate directory. That is going to be our MapsApiV2 project we will be trying to run. On my Mac it was located at
<sdk_location>/extras/google/google_play_services/samplesI
placed it to the
~/Work/stack/
2) Copied
google-play-services_libproject
directory to the same place (
~/Work/stack),
so my working directory looks like this. Btw, lib project is located at
<sdk_location>/extras/google/google_play_services/libproject:
3) Now let's open Android Studio. On welcome screen press
Import Projectand import our
mapsproject
from
~/Work/stack/maps.
Now we see a lot of complaints about unknown reference to GMS library:
4) Now we need to add Google Play Service as a reference library. Going to
View -> Open Module Settings
5) On the
Modulestab,
click
+button
and select
Import Moduleand import your GooglePlayServices lib. I didn't change anything in the wizards, so clicked
Nextall
the way to the end:
6) Now you need to reference this imported library. Open this screen again (go to
View -> Module Settings). Make sure you have your
mapsproject
and
Dependencytab
selected. Click
+to
add a dependency and select
Library.
Choose your imported library there:
7) Now we can see that it is not complaining about
GMSlibrary,
but still complaining about support library:
8) Let's fix it. I have my support library
located at
<sdk location>/extras/android/support/v13/android-support-v13.jar. So let's try to add it to our workspace. Go to
View -> Open Module Settingsand select
Librariestab.
Select
+->
Javaand
select support library:
9) Now it is going to ask you which
project to add this lib to, so make sure you have selected your
mapsproject:
10) At this point code should compile w/o problems. Just make sure you are targeting the right SDK version in Manifest.
转载地址:http://stackoverflow.com/questions/16596715/how-can-i-create-an-android-application-in-android-studio-that-uses-the-google-m?rq=1
相关文章推荐
- How to Pop Open an image window that resizes to fit the image in ASP.net 1.x and 2.0 Beta 1
- How to build an OLE DB application for SQL Server CE in Visual Studio 2005
- javascript - C++, Qt, QtWebKit: How to create an html rendering window so that your application would get callbacks from JS calls? - Stack Overflow
- vs2005部署错误解决方法:ASPNETMERGE : error 1013: Cannot find any assemblies that can be merged in the application bin folder.
- How can I create an Asynchronous function in Javascript?
- How one VBA project can use an object declared in the class module of another project
- How can I throw an exception without losing the original stack trace information in .NET?
- An error message detailing the cause of this specific request failure can be found in the application event log of the
- How To Customise the Tab Bar (UITabBar) in an iPhone Application (Part 1 of 2)
- HowTO: Create an Event Log Source in code, without the Permission errors
- How can I get the IPv4 address of an interface in linux from C code ?
- 《How hard can it be? Estimating the difficulty of visual search in an image》和 PPT
- How To Customise the Tab Bar (UITabBar) in an iPhone Application (Part 2 of 2)
- iOS memory allocation - how much memory can be used in an application?
- How can I recover a file that I deleted in my local repo from the remote repo in Git?
- Here's an example that shows how to enumerate through the features of a selection set, returning the value of each field in the attribute table except for the geometry colum.
- 笔记: SAP How-to Guide: How To... Create an Application and Security profile in SMP 3.0
- How to fix Rosetta stone error 2123 -- "This was an error in the application"
- How can I get an object's absolute position on the page in Javascript?
- Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server.