Android studioError:(13, 0) Gradle DSL method not found: 'android()'解决方法
16lz
2021-01-23
贴出在studio导入项目出现的错误问题。
Error:(13, 0) Gradle DSL method not found: ‘android()’
Possible causes:
- The project ‘ScanDemo’ may be using a version of the Android Gradle plug-in that does not contain the method (e.g. ‘testCompile’ was added in 1.1.0).
Fix plugin version and sync project - The project ‘ScanDemo’ may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file - The build file may be missing a Gradle plugin.
Apply Gradle plugin 图片如下:
这个问题是因为,我们导入项目,studio会检查导入的项目的版本是否本地存在这个版本,如果不存在,一般会提示错误:
一般解决版本去下载这个版本,可以解决!
但也一种情况是studio在导入项目的时候,如果不存在版本,会在整个项目(最外层的)build.gradle加上android {
compileSdkVersion 21
buildToolsVersion “21.0.0”
},
也有可能导入版本不存在这边版本,你手动去修改app下对应的SDK版本,这种情况也会出现Gradle DSL method not found: ‘android();
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' }}android { compileSdkVersion 21 buildToolsVersion "21.0.0" }
解决方案是:删除最外层build.gradle的
android {
compileSdkVersion 21
buildToolsVersion “21.0.0”
}
重新编译就可以了,希望能帮助到您!
更多相关文章
- android 集成腾讯bugly版本升级功能
- android Context错误使用引发的内存泄露
- android 中xml文件中出现 Attr.value missing 错误
- 一个提供Android各历史版本在线源码的网址
- android 导入项目报错
- Android 图片加载Bitmap OOM错误解决办法
- Android导入项目时Android jar包丢失的解决
- Android团队提供的示例项目