Monday, October 19, 2015

Android - Configure your Eclipse project to work with Google Map

Hello

Change on eclipse.ini Xmx1024m   !!!!

Skip these steps 1,2,3.a-e if you have Android SDK and Google Play services SDK and the Android Support Library

  1. 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.
  2. 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.


3. Add Google Play services to your Eclipse project:
  1. 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.
  2. In Eclipse, click File > Import > Android > Existing Android Code into Workspace then click Next.
  3. Browse to the copy of the library project and import it.
  4. Select the option to Copy projects into workspace.
  5. Click Finish i have put it under E:\nathan\android\External, but i have allready imported it to the workspace
4. Reference the Google Play services library as a dependency for your map app project:
  • Right-click your map app 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.


5. Add the Android Support Library to the demo ('maps') app:
  1. Create a libs/ directory in the root of the maps project.
  2. 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.)
  3. In Eclipse, right click the JAR file and select Build Path > Add to Build Path.

6. 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)

7. add to your AndroidManifest.xml inside the application tag
<meta-data android:name="com.google.android.geo.API_KEY"

    android:value="......."/>

  <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

android:value is the key you get per application package according to this

add 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  <uses-permission android:name="android.permission.INTERNET"/>
     
 <!-- Maps API needs OpenGL ES 2.0. -->
  <uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>

Nathan

No comments:

Post a Comment