Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android It Depends On You

Alex Londono
Alex Londono
2,033 Points

Watching these gradel videos, I'm trying to get my google API's to work

I went to the google site: https://developers.google.com/android/guides/setup

When I paste in compile 'com.google.android.gms:play-services:10.0.1' it causes an error in Android studio when I try to reSync gradel.

any one know how to get this working?


my Source:

To make the Google Play services APIs available to your app:

Open the build.gradle file inside your application module directory. Note: Android Studio projects contain a top-level build.gradle file and a build.gradle file for each module. Be sure to edit the file for your application module. See Building Your Project with Gradle for more information about Gradle. Add a new build rule under dependencies for the latest version of play-services. For example: apply plugin: 'com.android.application' ...

dependencies {
    compile 'com.google.android.gms:play-services:10.0.1'
}

Be sure you update this version number each time Google Play services is updated. Note: If the number of method references in your app exceeds the 65K limit, your app may fail to compile. You may be able to mitigate this problem when compiling your app by specifying only the specific Google Play services APIs your app uses, instead of all of them. For information on how to do this, see Selectively compiling APIs into your executable. Save the changes and click Sync Project with Gradle Files in the toolbar.

1 Answer

Kourosh Raeen
Kourosh Raeen
23,733 Points

Have you downloaded and installed Android Support Repository, Google Play Services, and Google Repository? Open the SDK manager and make sure they are installed and see if they need to be updated.

Alex Londono
Alex Londono
2,033 Points

I found out I had Android Support Repository and Google Repository, but was missing Google Play Services. Downloading now.