2016-10-13 54 views
4

得到一個錯誤方法的Android(),當我嘗試編譯我的項目工作室,我有搜索頗有幾分,沒有真正解決它找不到論據org.gradle.api.Project

錯誤:(17,0)在類型爲org.gradle.api.Project的根項目'booksStudioDir'上無法找到參數[build_a7zf1o8ge4ow4uolz6kqzw5ov $ _run_closure2 @ 19201053]的方法android()。

這是我的生成/ gradle這個文件的樣本

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:[email protected]') { 
    transitive = true; 
    } 
    compile project(':owncloud') 
} 
+0

可能複製http://stackoverflow.com/questions/37250493/could-not-find-method-android-for-arguments – nshmura

+0

@nshmura我沒有找到我的答案與 – Omega

+0

你定義一個機器人塊在你的頂級build.gradle中? – nshmura

回答

0
buildscript { 

    ext.versions = [ 
      'compileSdk' : 27, 
      'targetSdk'  : 27, 
      'buildTools' : '27.0.3', 
      'butterknife' : '8.8.1', 
      'glide'   : '4.6.1', 
      'kotlin'  : '1.2.21', 
      'retrofit'  : '2.3.0', 
      'supportLibrary': '27.0.2' 
    ] 

    repositories { 
     google() 
     jcenter() 
    } 

    dependencies { 
     classpath 'com.android.tools.build:gradle:3.2.0-alpha01' 
     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" 
    } 

} 
+0

感謝您的回答。請添加一些解釋,以提高您的答案的可讀性和接受度。 –