天天看点

AS导入项目报错:Plugin with id 'com.android.application' not found.

从github或第三方Demo中获取的项目导入到AndroidStudio中报错Plugin with id 'com.android.application' not found.;今天导入一个讯飞的Demo看项目的目录明显不对,感觉少了个build.gradle;只有Module的build.gradle、没有Project的build.gradle;

AS导入项目报错:Plugin with id 'com.android.application' not found.

正常的应该是这样:

AS导入项目报错:Plugin with id 'com.android.application' not found.

于是百度一圈,给出解决方法;

1、找一个可以正常编译的项目或新建一个项目,把Project中的build.gradle中的代码复制一下,如下图;

2、粘贴到这个报错项目的build.gradle中,放在最下面即可,下面代码;

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}
           

粘贴位置:

AS导入项目报错:Plugin with id 'com.android.application' not found.

编译一下就能编译通过了;一般出现这个问题的原因是别人直接把Module扔上去了;

转载于:https://www.cnblogs.com/cuichen16/p/10785951.html