栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Android Studio构建新项目错误

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Android Studio构建新项目错误

Android Studio构建gradle 新项目错误
    报错
Build file 'D:AndroidWeatherAppbuild.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
	

    解决

      路径:Gradle scripts > build.gradle
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            //        google() //注释这行
            //        mavenCentral() //注释这行
            maven { url 'https://plugins.gradle.org/m2/' } //复制这行
            maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' } //复制这行
            maven { url 'https://maven.aliyun.com/nexus/content/groups/public' } //复制这行
            maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'} //复制这行
        }
        dependencies {
            classpath "com.android.tools.build:gradle:7.0.4"
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    plugins {
    //    id 'com.android.application' version '7.1.2' apply false
    //    id 'com.android.library' version '7.1.2' apply false
        id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    
      路径:Gradle scripts > settings.gradle
    dependencyResolutionManagement {
    		    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    		    repositories {
    		//        google() //注释这行
    		//        mavenCentral() //注释这行
    		//        jcenter() // Warning: this repository is going to shut down soon //注释这行
    		
    		        maven { url 'https://plugins.gradle.org/m2/' } //复制这行
    		        maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' } //复制这行
    		        maven { url 'https://maven.aliyun.com/nexus/content/groups/public' } //复制这行
    		        maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'} //复制这行
    		    }
    		    rootProject.name = "My Application" //项目名称
    		    include ':app'
    		}
    
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/759697.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号