4

I keep getting this error in Android Studio Electric Eelenter image description here

// Top-level build file where you can add configuration options common to all sub-projects/modules.

plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}

I've tried using the answers these two posts but nothing works maybe because those posts are older and they were using older versions of Android Studio https://stackoverflow.com/questions/73099487/plugin-id-com-android-application-version-7-2-0-apply-false-was-not-f https://stackoverflow.com/questions/71427323/gradle-sync-failed-plugin-id-com-android-application-version-7-1-2-app

I also reinstalled Android Studio and it still didn't work.

fleezi
  • 53
  • 1
  • 4

5 Answers5

2

Setting>Build, appearance, deployment>Gradle enter image description hereGradle JDK: Jbr-11

I was having the same problem but by using this progress I have solved that problem. You should also try this I hope this will work.

zaid tahir
  • 31
  • 4
0

Today I solved it. Previously I set up Gradle JDK: Jbr-11. My country has internet restrictions so I use "Proton VPN" (free version), and NetLimiter 4 Pro as a firewall to conect my laptop.

The problem dissapeared when i turned off my firewall, with the VPN on. Android Studio started to download files it needed. It worked due the firewall was blocking an Android Studio task i hadn't seen.

But then another problem appeared in activity_main.xml: "Class referenced in the layout file, 'androidx.constraintlayout.widget.ConstraintLayout', was not found in the project or the libraries "

To solve this, try:

  1. Open your build.gradle (application-level) file and make sure that it has the ConstraintLayout dependency.

    dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.1.4' //... }

    If the dependency is not there, add the dependency in the build.gradle file and synchronize the project.

  2. If dependency was already there, try cleaning up and rebuilding your project. Build -> Clean Project, when it finished: Build -> Rebuild Project.

  3. Delete the .idea folder and let these files download when you open Android Studio. (This is what finally worked for me)

Milo
  • 1
  • 2
0

Add the following code to the settings.gradle.kts file

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
0

Had the same problem, it was with conflict of JDK version. So the problem is Compatibility. Use right Java version and Gradle version to support it. Now i use Gradle JDK corretto-19.

Younes Charfaoui
  • 1,059
  • 3
  • 10
  • 20
0

Alright, so... here's what could be causing this problem of yours and how you might be able to solve it :

The main reason why this happens is that obviously as it shows it can't find certain versions of stuff in your gradle files and a possible fix could be to change the location of "gradle user home" to your project's gradle folder which is "\path_to_your_project\.gradle" as shown in this picture :

( You can find the mentioned setting in Settings-> Build, Execution, Deployment->Build Tools->Gradle )

click to see the image

I had a similar problem recently and this way I was able to fix it so I hope it works for you too !

Angel
  • 11
  • 4