簡體   English   中英

無法在org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@397740e0上找到屬性'compile'

[英]Could not find property 'compile' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@397740e0

我正在使用parse.com啟動程序進行為期兩天的講座而沒有任何問題。 我離開了幾分鍾,沒有任何東西,我可以看到被改變,現在它不會同步。 我已經搜索過,但沒有發現任何我看錯了。 在此先感謝您的幫助。

這是錯誤:

Error:(36, 0) Could not find property 'compile' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@397740e0.

打開文件

這是我的gradle文件:

apply plugin: 'com.android.application'
apply plugin: 'com.parse'

buildscript {
    repositories {
        mavenCentral()
        maven { 
            url 'https://maven.parse.com/repo' 
        }
    }
    dependencies {
        classpath 'com.parse.tools:gradle:1.+'
    }
}

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "com.parse.starter"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {


    compile
    'com.android.support:appcompat-v7:22.2.1' compile
    'com.parse.bolts:bolts-tasks:1.3.0' compile
    'com.parse:parse-android:1.11.0' compile
    'com.android.support:design:22.2.1'
    compile 'com.android.support:design:22.2.1'
}

/* Uncomment if you enable ProGuard and you want to automatically upload symbols on build.
parse {
  applicationId "YOUR_APPLICATION_ID"
  masterKey "YOUR_MASTER_KEY"

  // Make symbol upload automatic. Otherwise, use e.g. ../gradlew parseUploadSymbolsDebug;
  uploadSymbols true
}
*/

您已將compile用作屬性,但它不是一個。 您需要將字符串參數傳遞給它。

compile 'com.android.support:appcompat-v7:22.2.1' 
compile 'com.parse.bolts:bolts-tasks:1.3.0' 
compile 'com.parse:parse-android:1.11.0'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:design:22.2.1'

編輯 :正如人們在評論中提到的,你不應該有兩個相同的依賴。 但是,這不會導致您描述的問題。 我相信當你使用gradle構建時,它可能會導致“意外的頂級異常”。

compile
'com.android.support:appcompat-v7:22.2.1' compile
'com.parse.bolts:bolts-tasks:1.3.0' compile
'com.parse:parse-android:1.11.0' compile
'com.android.support:design:22.2.1'
compile 'com.android.support:design:22.2.1'

只需格式如下:

compile'com.android.support:appcompat-v7:22.2.1' 
compile 'com.parse.bolts:bolts-tasks:1.3.0' 
compile 'com.parse:parse-android:1.11.0' 
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:design:22.2.1'

我有同樣的錯誤,並且@Akhil建議您必須確保編譯語法如上所述。

對於我升級后,gradle編譯行中斷被刪除,

compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.parse.bolts:bolts-tasks:1.3.0'
compile 'com.parse:parse-android:1.11.0'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:design:22.2.1'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM