skip to Main Content

Error when running the application. I changed the system and installed all the programs again and the same error persists

this error

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:UsersmustaAndroidStudioProjectsuntitledandroidappbuild.gradle’ line: 2

  • What went wrong:
    Plugin [id: ‘com.android.application’] was not found in any of the following sources:

  • Gradle Core Plugins (plugin is not in ‘org.gradle’ namespace)
  • Plugin Repositories (plugin dependency must include a version number for this source)
  • Try:

Run with –stacktrace option to get the stack trace.
Run with –info or –debug option to get more log output.
Run with –scan to get full insights.

BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1

2

Answers


  1. You Can add or Update the dependencies in your build.gradle file in app folder.
    OR
    You can add the Zip Url in gradle-wrapper-properties in gradle/wrapper/ in distributionUrl

    Login or Signup to reply.
  2. It seems like there might be an issue with your Gradle setup or configuration. Here are a few steps you can try to troubleshoot and resolve this error:

    1. Check Gradle Plugin: Ensure that your build.gradle file in the android/app directory specifies the correct Gradle plugin for Android application. It should look something like this:

      apply plugin: 'com.android.application'
      
    2. Gradle Wrapper: Verify that you have the Gradle wrapper files (gradle-wrapper.properties, gradlew, gradlew.bat) in your project directory. These files are essential for running Gradle tasks.

    3. Gradle Version: Make sure that your project’s gradle/wrapper/gradle-wrapper.properties file specifies a valid Gradle version. You can set it to a specific version or use the default distribution provided by Android Studio.

    4. Check Gradle Plugin Repositories: Ensure that your Gradle settings are configured to fetch plugins from the appropriate repositories. You can check your settings.gradle file and build.gradle files to ensure that the plugin dependencies are correctly specified.

    5. Clean and Rebuild: Try cleaning your project and rebuilding it. You can do this from the Android Studio toolbar by selecting Build > Clean Project and then Build > Rebuild Project.

    6. Check Network Connection: If you’re behind a firewall or using a proxy, ensure that your network settings are configured correctly to allow Gradle to fetch dependencies from the internet.

    7. Update Gradle Plugin: If you’re using an older version of Android Studio or Gradle, consider updating to the latest version to see if the issue is resolved.

    8. Check Gradle Distribution URL: In your gradle/wrapper/gradle-wrapper.properties file, verify that the distributionUrl points to a valid Gradle distribution. It should look something like this:

      distributionUrl=https://services.gradle.org/distributions/gradle-x.x.x-all.zip
      

    After trying these steps, attempt to rebuild your project again. If the issue persists, try running Gradle with the --stacktrace, --info, or --debug options as suggested in the error message to get more detailed information about the failure. Additionally, you can consult the provided link for more help or search for similar issues online to find potential solutions.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search