[英]Could not find method android() for arguments while import android studio project
when i import android studio project then arise the error could not find android error 22 hoe it is solve 当我导入android studio项目然后出现错误找不到android错误22 it这是解决
my gradle file is here 我的gradle文件在这里
buildscript
{
repositories
{
jcenter()
}
dependencies
{
classpath 'com.android.tools.build:gradle:+'
}
}
allprojects
{
repositories
{
jcenter()
}
}
task clean(type: Delete)
{
delete rootProject.buildDir
}
android
{
compileSdkVersion 25
buildToolsVersion '24.0.3'
defaultConfig
{
minSdkVersion 14
targetSdkVersion 23
}
productFlavors
{
}
}
This is my gradle file and it show error like could not find the android 这是我的gradle文件,它显示错误,例如找不到android
Here is the screen shot of the error 这是错误的屏幕截图
So please tell me how to solve this error Thanks 所以请告诉我如何解决这个错误
Try this 尝试这个
buildscript
{
repositories
{
jcenter()
}
dependencies
{
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
Do not use + in classpath 'com.android.tools.build:gradle:+' 不要在类路径'com.android.tools.build:gradle:+'中使用+
This is not where you are supposed to add android {}
block. 这不是您应该添加android {}
块的地方。
The project structure goes like: 项目结构如下:
DriverApp
--app
----build.gradle
--build.gradle
The android {}
block is supposed to be in the DriverApp/app/build.gradle
and not DriverApp/build.gradle
. android {}
块应该位于DriverApp/app/build.gradle
,而不DriverApp/build.gradle
。 Move that block and it should fix your issue. 移动该块,它应该可以解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.