导入工程sync时候提示 找不到id为“com.android.application”的插件。

导入工程sync时候提示 找不到id为“com.android.application”的插件。

正在回答

登陆购买课程后可参与讨论,去登陆

2回答

源码是module的,可以参考如下方式导入

http://img1.sycdn.imooc.com//climg/5dcb746209fb506205600256.jpg

  • 喝白酒的兔子 提问者 #1
    谢谢,我用下面的方法搞定了,供后来者参考: 打开报错的项目的build.gradle,看看有没有buildscript{}(应该是没有的,因为就是没有这个东西才报错的): buildscript { repositories { //添加阿里云镜像,加快同步速度 maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} google() jcenter() } dependencies { //版本号根据Android studio填写 classpath 'com.android.tools.build:gradle:3.5.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} google() jcenter() } } 把上面这段粘贴到build.gradle中,重新同步。
    2019-11-13 12:06:07
提问者 喝白酒的兔子 2019-11-13 12:07:13

打开报错的项目的build.gradle,看看有没有buildscript{}(应该是没有的,因为就是没有这个东西才报错的):

buildscript {
    repositories {
        //添加阿里云镜像,加快同步速度
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
        google()
        jcenter()
    }
dependencies {
    //版本号根据Android studio填写
    classpath 'com.android.tools.build:gradle:3.5.2'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
    maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
    google()
    jcenter()
    }
}

把上面这段粘贴到build.gradle中,重新同步。

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师