0

I initially had a problem like the one below and I made a post

Plugin with id 'com.android.application' not found

then the post of the problem was closed because there was already a familiar problem, with the highest rated answer as below (update gradle)

answer url

Latest Gradle: 6.5

Version check: ./gradlew -v

How to update:

Set URL: ./gradlew wrapper --gradle-version=6.5 --distribution-type=all

Update: ./gradlew wrapper

but I don't have a gradlew file, then I took the initiative to create a new project and I took the gradlew file, settings.gradle file along with the gradle folder, then I ran the command from the answer above, but stuck in the command (in the Set URL version I use 7.2, because when creating a new project the gradle version is the default)

./gradlew wrapper

the command raises an error

Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'app/build.gradle'

then I tried to find a solution, and I got a similar question and there was an answer that was ticked in green as below

answer url

Android introduced a new way to define repositories.

Remove the dependencyResolutionManagement block from the setting.gradle file to have your project work the old way.

but after i removed the dependencyResolutionManagement block from setting.gradle i got the same problem at the beginning i.e

Plugin with id 'com.android.application' not found

the following is the contents of the settings.gradle file before I delete the dependencyResolutionManagement block

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "My Application6"
include ':app'

below is the contents of the settings.gradle file after I removed the dependencyResolutionManagement block

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

rootProject.name = "My Application6"
include ':app'

note: when an error appeared the last time I tried, rootProject.name was not the same as the current project

Mee Mihoyo
  • 71
  • 1
  • 6

0 Answers0