Search code examples
androideclipsegoogle-play-servicesgoogle-analytics-firebase

GoogleAnalytics SDK v4 For Android - Integration - Corrupts my application


This is a bit weird and i am not sure how to put it. I am trying to integrate GoogleAnalytics SDK v4 from official site.

Here is what i have done till now..

  1. Copied the google-play-services_lib folder from android-sdks/extras/google/google_play_services/libproject/google-play-services_lib and placed in my root folder of the application.

  2. In Eclipse -> Imported the google-play-services_lib project into my workspace using File->Import->Android->Existing code into workspace, browsed to the root folder of application and imported it.

  3. When i add google-play-services_lib to my project as library, using properties->Android->Library and selecting google-play-services_lib folder, my existing project gets corrupted.

The gen folder and bin folder becoming empty, hinting me that there is some problem with building the project. But, I am not sure what it is. What am i doing wrong?


Solution

  • May be useful for future readers...

    The problem is with google-play-services_lib project. There are couple of things that you should do to overcome this. The problem occurs because google-play-sevices_lib project uses a minimum SDK version of 9 which is obsolete. So here is what you have to do.

    1. Launch Android SDK Manager. At the bottom left, check the box that says "obsolete". Now you will find a folder for Android 2.3.1(9). Install all the contents of that.

    2. Copy google-play-services_lib project from the android-sdks/extras/google/google_play_services/libproject/google-play-services_lib to your application folder and import it into the workspace.

    3. Modify the AndroidManifest.xml of google-play-services_lib project. Change the minimum SDK version to >=10 or less than 9 (I had minimum of 8 in my app, so i changed it to 8).

    4. Modify the project.properties file of google-play-services_lib project. Change target-9 to target-21(Lollipop is the latest version at present).

    5. Add google-play-services_lib project as library to your project.

    This should solve it.