Remove Google Play Services from app in Android Studio-ThrowExceptions

Exception or error:

I am working on an example app in Android Studio and I somehow accidentally added Google Play Services to one of my Activities. I’m not even sure how I did it, but it added several auto generated methods, variables and imports. I removed all of these and continued to work on the app. Now, a few days later, I found

compile ''

in my app/build.gradle script and an auto-generated chunk in my manifest file:

     ATTENTION: This was auto-generated to add Google Play services to your project for
     App Indexing.  See for more information.
    android:value="@integer/google_play_services_version" />

under the <application> tag. When I remove them and build the project, the <meta-data> tag is regenerated in the manifest, which causes the build to fail since I removed the dependency in build.gradle.

How do I completely remove Google Play Services from the app and build system to stop this? What have I missed?

How to solve:

It just suggestion not a solution as I don’t know your complete scenario. Delete all dependencies and all the build folders from your application and rebuild the project.At least It will prompt you where the play services dependency is present

Hope it will work


As @Chinmay stated, removing all references to Google Play Service/App indexing and deleting ‘<-path-android-project->/app/build‘ solved this for me, also.



I also accidentally pressed on the quickfix to add “app indexing API code”, which was suggested even though it had absolutely nothing to do with my error.

What worked for me:

  • I went to VCS -> Local History -> Show History and in there I found “Insert App Indexing API Code” which I rightclicked and pressed “Revert”. This removed some things, but not all, so this quickfix certainly wasn’t quick to get rid off again.
  • Next I went through all my build.gradle files and inside dependencies{} I removed compile ''.
  • I removed these bits of Auto-generated code in the xml files the error led me to. They are marked with comments:

         ATTENTION: This was auto-generated to add Google Play services to your project for
         App Indexing.  See for more information.
  • Lastly I removed two different build folders in my project directory. Cleaning and building the project again finally worked.

I have to add that I cleaned, rebuilt and deleted build folders several times until it finally disappeared. Thanks to previous posters about deleting those build folder!


Actually when you remove the buggy lines in your manifest file, Android Studio doesn’t really remove them.

With another text editor, open (your project)\app\src\main\AndroidManifest.xml and remove <meta-data ... />
Then save the file, make sure that our build.gradle doesn’t contain the play-services-appindexing dependency anymore, and rebuild your project from Android Studio.


My results were similar to @AllBecomesGood

  1. I went into File->Settings=>Plugins and unticked:

    • Android Games
    • App Links Assistant
    • Firebase App Indexing
    • Firebase Services
    • Firebase Testing
    • Google Cloud Tools Core
    • Google Cloud Tools For Android Studio
    • Google Login
    • Google Services
  2. I then removed both the build directory within the App folder and at the root of my application.

  3. I removed the build reference to in the build.gradle for my app under dependencies. I removed the references that were auto inserting in the android manifest.

  4. Finally I had to restart Android studio before I rebuilt, otherwise it would insert into the manifest.


It’s simple

  • Click right on app -> Open Modules settings
  • Click Dependency tab
  • Select play-services line
  • and click delete (small minus on top right)

That’s it


If you using buildToolsVersion "23.0.2"

Use new version:

compile ''

Hope this work for you

Sorry I just got it now this not answer for your question


Don’t worry, it’s easy. I had same problem and I resolved it, while deleting this line of source code from dependency.

I had installed latest Google Play Service in my Android Studio, but I was using the below line in dependency.

compile ''

Just remove this line if you are using it.

Leave a Reply

Your email address will not be published. Required fields are marked *