Search code examples
androidgoogle-chromeandroid-studioandroid-support-librarychrome-custom-tabs

"Please install Android Support Repository" warning while setting up Chrome Custom Tabs


I'm trying to replace WebView with Chrome Custom Tabs in my app for my users to get access to the content faster.

So I'm following the Chrome Developer Site Docs here.

I've added this dependency to my gradle file:

dependencies {
...
compile 'com.android.support:customtabs:27.0.2'
}

But after I've done this, I get an error that I need to install the Android Support Repository, even if it's already installed.

Error output:

    Error:(10, 0) Could not find method compile() for arguments [com.android.support:customtabs:27.0.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Please install the Android Support Repository from the Android SDK Manager.
<a href="openAndroidSdkManager">Open Android SDK Manager</a>

I've also read some other posts that users are experiencing this issue (but in their case it's not related to Chrome Custom Tabs) and some users wrote that this issue is because of the SDK location is set wrong.

I've checked mine and everything is ready & set. Also checked if another SDK location exists on my computer but there is only one.

Location: /Users/ardacebi/Library/Android/sdk

Here is the SDK Manager saying that the Android Support Repository is installed and no updates are available:

I've also tried uninstalling and reinstalling the Support Repository 3 times.

What should I do? Thanks.


Solution

  • Error:(10, 0) Could not find method compile() for arguments [com.android.support:customtabs:27.0.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

    It happens because you are adding the dependency in your top-level build.gradle file. Use the module build.gradle to add your dependencies.