This version of the Android Support plugin for IntelliJ IDEA or Android Studio cannot open this project, please retry with version 2021.1.1 or newer
解决
低版本的android导入高版本的工程
7.2修改适配android 4.2.1
1、setting.gradle
保留rootProject.name = ""和include ‘:app’,其余注释
//pluginManagement { // repositories { // gradlePluginPortal() // google() // mavenCentral() // } //} //dependencyResolutionManagement { // repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) // repositories { // google() // mavenCentral() // } //} rootProject.name = "Setting" include ':app'
2、build.gradle
注释掉原先的plugins{}
添加
buildscript {}
allprojects {}
task clean(type: Delete) {
delete rootProject.buildDir
}
Top-level build file where you can add configuration options common to all sub-projects/modules. //plugins { // id 'com.android.application' version '7.3.1' apply false // id 'com.android.library' version '7.3.1' apply false //} // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:4.2.1" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() mavenCentral() jcenter() // Warning: this repository is going to shut down soon } } task clean(type: Delete) { delete rootProject.buildDir }
重新build即没有报错。
参考:Android Studio记录问题:Unrecognized Android Studio (or Android Support plugin for IntelliJ IDEA) version