[英]Could not find method android() for arguments org.gradle.api.Project
i have just imported a project(working) to my android studio. 我刚刚将一个项目(工作)导入我的android工作室。 first when it imported, im getting this error: 首先它导入时,我得到这个错误:
build tools is not working .api 23... 构建工具不起作用.api 23 ...
then i followed some answer in stackoverflow with my same error(question). 然后我在stackoverflow中跟我回答了一些错误(问题)。
i go to file>project structure>select module>
and choose : 我去file>project structure>select module>
并选择:
compile sdk version = 6.0; 编译sdk版本= 6.0;
build tools version = 23.0.1. 构建工具版本= 23.0.1。
then, i clean project... 然后,我清理项目......
and i got this error : 我收到了这个错误:
Error:(16, 1) A problem occurred evaluating root project 'ThreatMap'. 错误:(16,1)评估根项目'ThreatMap'时出现问题。
Could not find method android() for arguments [build_760vbdomi0tz2p8mkdshyqph9$_run_closure2@5e6cdc1e] on root project 'ThreatMap' of type org.gradle.api.Project... 无法在类型为org.gradle.api.Project的根项目'ThreatMap'中找到方法android()for arguments [build_760vbdomi0tz2p8mkdshyqph9 $ _run_closure2 @ 5e6cdc1e] ...
heres the code in build.gradle (project-level): 继承了build.gradle(项目级)中的代码:
buildscript {
repositories { jcenter() }
dependencies { }
}
allprojects {
repositories { jcenter() }
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
}
dependencies { }
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.threatmapper"
minSdkVersion 18
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:23.0.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.android.gms:play-services-maps:7.0.0'
}
sdk android version installed sdk安装了android版本
Not missing, but messed up. 不要错过,但搞砸了。 You are not adding the gradle wrapper to the project. 您没有将gradle包装器添加到项目中。 It should contain something like this: 它应该包含这样的东西:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
}
}
allprojects {
repositories {
jcenter()
}
}
the 2.2.2 corresponds to the most recent version of Android Studio. 2.2.2对应于最新版本的Android Studio。 Replace that with yours. 用你的替换。 And I also would suggest to move the android { compileSdkVersion 23 buildToolsVersion '23.0.1' }
block to the module's build.gradle file 我还建议将android { compileSdkVersion 23 buildToolsVersion '23.0.1' }
块移动到模块的build.gradle文件中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.