对于类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的对象的未知属性'依赖'

时间:2017-07-13 16:20:49

标签: android twitterkit

我正在尝试克隆此twitter kit repository,并想在android studio中打开示例应用程序。然后我得到这个gradle同步错误:

Error(3,0) Could not get unknown property 'dependency' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

包含此错误的gradle文件:

buildscript {
    dependencies {
        classpath dependency.spoonGradlePlugin
    }
}

//Load API Key information in from property file
Properties props = new Properties()
try {
    props.load(file('twitter.properties').newDataInputStream())
} catch (Exception ex) {
   // throw new GradleException("Missing twitter.properties, check the twitter.properties.sample file.");
}

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

android {
    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion rootProject.buildToolsVersion

    defaultConfig {
        applicationId "com.example.app.twitter"
        versionCode 1
        versionName "1.0"
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion
        testInstrumentationRunner "com.example.app.SpoonInstrumentationTestRunner"
    }

    buildTypes {
        debug {
            resValue "string", "com.twitter.sdk.android.CONSUMER_KEY", "\"${props.getProperty("twitterConsumerKey")}\""
            resValue "string", "com.twitter.sdk.android.CONSUMER_SECRET", "\"${props.getProperty("twitterConsumerSecret")}\""
            resValue "bool", "com.twitter.sdk.android.TRACE_ENABLED", "true"
            resValue "bool", "com.twitter.sdk.android.COLLECT_IDENTIFIERS_ENABLED", "true"
            buildConfigField "String", "MOPUB_AD_UNIT_ID", "\"${props.getProperty("mopubAdUnitId")}\""
        }
        release {
            resValue "string", "com.twitter.sdk.android.CONSUMER_KEY", "\"${props.getProperty("twitterConsumerKey")}\""
            resValue "string", "com.twitter.sdk.android.CONSUMER_SECRET", "\"${props.getProperty("twitterConsumerSecret")}\""
            resValue "bool", "com.twitter.sdk.android.TRACE_ENABLED", "false"
            resValue "bool", "com.twitter.sdk.android.COLLECT_IDENTIFIERS_ENABLED", "true"
            buildConfigField "String", "MOPUB_AD_UNIT_ID", "\"${props.getProperty("mopubAdUnitId")}\""
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
    }

    packagingOptions {
        exclude 'LICENSE.txt'
    }

    spoon {
        if (project.hasProperty('spoonClassName')) {
            className = project.spoonClassName
        }
    }

    lintOptions {
        warningsAsErrors true
    }

    compileOptions {
        sourceCompatibility rootProject.sourceCompatibilityVersion
        targetCompatibility rootProject.targetCompatibilityVersion
    }
}

dependencies {
    compile project(':twitter')
    compile project(':twitter-mopub')
    compile dependency.appCompat
    compile dependency.design
    compile dependency.okHttpInterceptor

    debugCompile dependency.leakCanary
    releaseCompile dependency.leakCanaryNoOp

    androidTestCompile dependency.spoon
    androidTestCompile dependency.espresso
    androidTestCompile dependency.androidTestingSupport
}

我发现依赖项格式看起来不错。如何删除此错误并运行示例应用程序?

0 个答案:

没有答案