Home > Software engineering >  Android Studio plugin Gradle errors
Android Studio plugin Gradle errors

Time:04-18

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

  1. click on the project tab at the top - left of your android studio app.

  2. Down your project structure, click on Gradle Scripts. In the drop down, you will see two build.gradle files

  3. Open the build.gradle with (Module:Application_Name.app)

  4. Inside the build.gradle file opened, make sure the it contains the following at the top.

    plugins { id 'com.android.application'}

  5. Then build your application.

if you still receive this error, then open the other build.gradle file with (Project:Application_Name)

  1. 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

    }

  2. 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

gradle

CodePudding user response:

Can you try this

  1. Go to 'File'
  2. Click on 'Sync Project with Gradle files'
  3. Make sure you have internet connected
  • Related