0

I use Google Play Services as referenced project. Can anyone guide me how properly add it to my project Android.mk to get all build work done? Without referenced project use all is done fine.

Now the following errors happen (see build log below):

MapLocator/src/com/maplocator/MapFragment.java:13: package com.google.android.gms.common does not exist
        import com.google.android.gms.common.ConnectionResult;

MapLocator/src/com/maplocator/MapFragment.java:56: cannot find symbol
    symbol  : class GoogleMap
    location: class com.maplocator.MapFragment
        private GoogleMap mMap;

... and etc.
Yehor Nemov
  • 907
  • 2
  • 16
  • 31

2 Answers2

0

The answer is simple you have to generate correct JAR library with Eclipse export tools and define it as prebuilded java static libraries in Android.mk:

#Google Play Services
LOCAL_STATIC_JAVA_LIBRARIES += googleplayservices \
                                googleplayservices_lib
...
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += googleplayservices:libs/google-play-services.jar \
                                        googleplayservices_lib:libs/google-play-services_lib.jar

See details here: How to solve java.lang.NoClassDefFoundError for com.google.android.gms.R$styleable error?

Community
  • 1
  • 1
Yehor Nemov
  • 907
  • 2
  • 16
  • 31
-1

Right click on project and select properties. In the properties window on left side select Android. On the right you can see a Add button under library section. Click it and select google play services project which you might have imported previously .

Also add the below in the Android Manifest xml file

<meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
Rohit Goyal
  • 550
  • 8
  • 9