So i just wanted to creat a hello world app and this happened
Build file 'C:\Users\Yuness\AndroidStudioProjects\MyApplication2\build.gradle' line: 3
Plugin [id: 'com.android.application', version: '7.1.2', apply: false] was not found in any of the following sources:
Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Exception is: org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.android.application', version: '7.1.2', 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.1.2') Searched in the following repositories: Gradle Central Plugin Repository Google MavenRepo
CodePudding user response:
if your project is open in android studio, follow these simple steps as seen in the below screenshot
click on the project tab at the top - left of your android studio app.
Down your project structure, click on Gradle Scripts. In the drop down, you will see two build.gradle files
Open the build.gradle with (Module:Application_Name.app)
Inside the build.gradle file opened, make sure the it contains the following at the top.
plugins { id 'com.android.application'}
Then build your application.
if you still receive this error, then open the other build.gradle file with (Project:Application_Name)
check for plugin section and paste this below
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
}
Build your application.
if you dont find any of these file, it means you need to create the build.gradle. but as a beginner, is better to delete the project and create it again.
please make sure your internet is active to sync your gradle
CodePudding user response:
Can you try this
- Go to 'File'
- Click on 'Sync Project with Gradle files'
- Make sure you have internet connected