Issue
When I create a new project (with the default settings, wasn't modified) in the newest Android Studio version (no more updates available) I get this message:
Build file 'C:\Users\user\AndroidStudioProjects\MyApplication\build.gradle' line: 3
Plugin [id: 'com.android.application', version: '7.2.1', apply: false] was not found in any of the following sources:
...
Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.android.application', version: '7.2.1', apply: false] was not found in any of the following sources:Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:7.2.1')Searched in the following repositories:
Gradle Central Plugin Repository
MavenRepo at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:116) at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:42)
While I can open projects that were created with an older version just fine.
This is the default project structure:
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle:
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.myapplication"
minSdk 23
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
settings.gradle:
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "My Application"
include ':app'
I tried to lower the APG and Gradle versions, reinstall Android Studio, reset to default settings, but it still fails.
How can I resolve this error?
Solution
Turned out to a problem with the internet supply who blocked the access to the google()
repository.
Using hotspot solved the problem.
Answered By - ATP
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.