无法找到参数org.gradle.api.Project的方法android() [英] Could not find method android() for arguments org.gradle.api.Project
问题描述
错误:(17,0)当我尝试在studio中编译我的项目时,我搜索了很多相关的东西,但没有真正的解决方案。 )在org.gradle.api.Project类型的根项目'booksStudioDir'上无法找到参数[build_a7zf1o8ge4ow4uolz6kqzw5ov $ _run_closure2 @ 19201053]的方法android()。
这是我的build / gradle文件的示例
buildscript {
repositories {
maven {url'https: //maven.fabric.io/public'}
}
依赖关系{
classpath'io.fabric.tools:gradle:1.+'
}
}
apply plugin:'com.android.application'
apply plugin:'io.fabric'
android {
compileSdkVersion 21
buildToolsVersion23.0.1
defaultConfig {
applicationIdcom.peade.time
minSdkVersion 10
targetSdkVersion 13
}
signingConfigs {
release {
storeFile file(/ home / bestman / Desktop / mke )
storePasswordandroidkeys
keyAliaspeade
keyPasswordyes1234
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
存储库{
maven {url'https://maven.fabric.io/public'}
mavenCentral()
}
依赖关系{
compile'com.edmodo:cropper:1.0.1'
compile'com.android.support:support-v4:21.0.3'
compile'com.itextpdf:itextpdf:5.5.6'
//编译文件('libs / commons-lang3-3.3.2.jar')
编译文件('libs / dropbox-android-sdk-1.6.1.jar')
//编译文件('libs / httpmime-4.0.3.jar')
编译文件('libs / json_simple-1.1.jar')
编译文件('libs / picasso-2.5.2。 jar')
compile('com.crashl ytics.sdk.android:crashlytics:2.5.2@aar'){
transitive = true;
编译项目(':owncloud')
}
有两个build.gradle文件。一个在顶层持有者,另一个在模块持有者。
下面是一个例子。
顶级build.gradle:
< a href =https://github.com/nickbutcher/plaid/blob/master/build.gradle =nofollow noreferrer> https://github.com/nickbutcher/plaid/blob/master/build.gradle
模块的build.gradle:
https://github.com/nickbutcher/plaid/blob/master/app/build.gradle
android
块应位于模块的build.gradle 中。
我猜你必须在导致错误的顶级build.gradle中定义 android
块。
Getting a bug, when I try to compile my project in studio , i have search quite a bit with no real solution to it
Error:(17, 0) Could not find method android() for arguments [build_a7zf1o8ge4ow4uolz6kqzw5ov$_run_closure2@19201053] on root project 'booksStudioDir' of type org.gradle.api.Project.
This is a sample of my build/gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 21
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.peade.time"
minSdkVersion 10
targetSdkVersion 13
}
signingConfigs {
release {
storeFile file("/home/bestman/Desktop/mkey/key")
storePassword "androidkeys"
keyAlias "peade"
keyPassword "yes1234"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
compile 'com.edmodo:cropper:1.0.1'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.itextpdf:itextpdf:5.5.6'
// compile files('libs/commons-lang3-3.3.2.jar')
compile files('libs/dropbox-android-sdk-1.6.1.jar')
// compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/picasso-2.5.2.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
transitive = true;
}
compile project(':owncloud')
}
There are two build.gradle files. One is in the top-level holder, and the other is in module holder.
Below is an example.
Top-level build.gradle:
https://github.com/nickbutcher/plaid/blob/master/build.gradle
module's build.gradle:
https://github.com/nickbutcher/plaid/blob/master/app/build.gradle
The android
block should be in module's build.gradle.
I guess you must have defined the android
block in top-level build.gradle which is causing the error.
这篇关于无法找到参数org.gradle.api.Project的方法android()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!