天天看點

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