3

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

2
  • According to that tutorial the reference should be (note the quotes) dependencies { implementation("com.google.android.gms:play-services-cronet:18.0.1") } Commented Oct 6 at 15:22
  • Thanks for your reply. I tried that initially but it didn't work and returned the same error. The IDE recommended the one above. But that also doesn't work. Commented Oct 6 at 15:25

1 Answer 1

3

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)
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you @IsHacker. I just literally was reading Gemini output and trying that out. but you get the points!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.