Change on eclipse.ini Xmx1024m !!!!
The SDK demo app supplied with the Google Maps Android API includes samples illustrating the feature highlights of the API. In addition, the Google Maps repo on GitHub has a sample for adding a map to a wearable app, and you can find code snippets on each page of this developer's guide.
SDK demo app
A demo app is bundled with the Google Play services SDK. You can view the demo and use the sample code supplied. The name of the demo app is Google Maps API Demos. Follow the steps below to get the SDK and import the demo app as a project in your development environment.
- As a prerequisite, you need to install the Android SDK. Follow the guide to get the Android SDK. Note that Android Studio is the recommended development environment for Android projects, although you can download and use the Android SDK Tools (ADT) separately for use in Eclipse or other development environments.
- Download the latest version of the Google Play services SDK and the Android Support Library via the Android SDK Manager. For detailed instructions, see the Android guide to adding SDK packages.
- After installing the Google Play services SDK, you can import the demo app from the SDK into your project. Follow the instructions below for your development environment – Android Studio, or Eclipse with the Android Developer Tools (ADT) plugin.
Add Google Play services to your Eclipse project:- Copy the library project at
<android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/
to the location where you maintain your Android app projects. - In Eclipse, click File > Import > Android > Existing Android Code into Workspace then click Next.
- Browse to the copy of the library project and import it.
- Select the option to Copy projects into workspace.
- Click Finish. i have put it under E:\nathan\android\External, but i have allready imported it to the workspace
Import the demo app from the SDK into your Eclipse project:- In Eclipse, select File > New > Other > Android > Android Sample Project and click Next.
- Select the latest version of the Android SDK and click Next.
- If prompted to select a build target, select Google APIs and click Next.
- Scroll down the list of samples and select Maps [Google Play Services, rev <version number>]. Click Finish. project is maps on eclipse
- Reference the Google Play services library as a dependency for the demo app:
- Right-click the Maps project and choose Properties > Android.
- Check that the Library section contains a reference to the google-play-services_lib project, and that it has a green tick next to it. If it does not, click Add, select google-play-services_lib and click OK. For more details, see the guide to referencing a library project.
- Click OK to exit the properties dialog.
Add the Android Support Library to the demo ('maps') app:- Create a
libs/
directory in the root of the maps project. - Copy the JAR file from your Android SDK installation directory (
<android-sdk>/extras/android/support/v4/android-support-v4.jar
) into the newlibs/
directory. (Note that the version number, v4, may be different.) - In Eclipse, right click the JAR file and select Build Path > Add to Build Path.
- Copy the library project at
- Get your API key and add it to the demo app's manifest, as described in the signup guide. (check explaination in my blog - Google Map Enahnced)
- The package name for the demo app is
com.example.mapdemo
. Note that the demo app already includes an API key in its manifest file. You must replace the key with your own API key. - Run the demo app:
- If you haven't already done so, connect an Android device to your computer. Follow the instructions to enable developer options on your Android device and configure your application and system to detect the device. Alternatively, you can use the Android Emulator to run your app. Use the Android Virtual Device (AVD) Manager to configure one or more virtual devices. You need an emulator image with the Google APIs platform based on Android 4.2.2 or higher. Take note of the instructions on configuring virtual machine acceleration, which you should use with an x86 target AVD. This will improve your experience with the emulator.
- Run the Maps project and select the Android device or emulator that you have configured.
The first screen of the demo app displays a list of available demos that you can run on your own device. This screenshot shows an example of what you will see:
Select one of the options. For example, click Basic Map.
Troubleshooting: If the demo app runs successfully but you don’t see a map, check that you’ve added your API key to the app’s manifest file.
Code snippets in the developer's guide
Each page in the developer's guide includes code snippets illustrating a particular feature of the API. For example, see the guides for map objects, markers, shapes, and other pages in this guide.
remark :
The minute i click on the first option in the list - "Basic Map"
i get error :
but the map seems to work
References :
Nathan
No comments:
Post a Comment