Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved reference: implementation' in build.gradle.kts file when adding dependencies

I'm new to Android and I'm following this tutorial(https://developer.android.com/develop/connectivity/cronet/start#java)

It says to add this dependency in my build.gradle.kts file, it looks like this:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    alias(libs.plugins.android.application) apply false
}

dependencies {
    implementation(libs.play.services.cronet)
}

Unfortunately this error shows up:

Unresolved reference: implementation

And the log file says this:

  Line 7:     implementation("com.google.android.gms:play-services-cronet:18.1.0")
              ^ Unresolved reference: implementation

It seems like something needs to be pulled in somewhere. It seems to be that the build system doesn't have some file which defines "implementation". I'm not sure which file that is and where I could add it in the config.

Thanks

like image 859
Dan Avatar asked May 24 '26 14:05

Dan


1 Answers

You are trying to add the dependency in your top-level build.gradle.kts file. You need to add it in your app-level file located in app/build.gradle.kts.

The syntax will be the same, just add it to the dependencies{} section.

dependencies {
 // Other dependencies here
 ...

 implementation(libs.play.services.cronet)
}
like image 165
IsHacker Avatar answered May 27 '26 03:05

IsHacker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!