Build.gradle不同步Android Studio

时间:2017-03-26 16:27:08

标签: android android-gradle build.gradle google-fabric crashlytics-android

我在Android应用的build.gradle文件中存在以下依赖项。

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/mxparser.jar')

    // View dependency injection library by Jake Wharton
    compile 'com.jakewharton:butterknife:8.5.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

    // apt command comes from the android-apt plugin
    compile 'com.google.dagger:dagger:2.9'
    annotationProcessor "com.google.dagger:dagger-compiler:2.9"
    provided 'javax.annotation:jsr250-api:1.0'

    // Crash reporting SDK
    compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
        transitive = true;
    }
}

但是当我将Crashlytics添加为依赖项时,我收到以下错误:

Error:Failed to resolve: annotationProcessor
Failed to resolve: com.crashlytics.sdk.android:crashlytics:2.6.7

Project Build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

1 个答案:

答案 0 :(得分:1)

确保您已添加

    In addition: Warning messages:
    1: In if (!file.exists(str_c(folder, "/", page_name))) { :
      the condition has length > 1 and only the first element will be used
    2: In if (file == "") file <- stdout() else if (substring(file, 1L,  :
      the condition has length > 1 and only the first element will be used
    3: In if (substring(file, 1L, 1L) == "|") { :
      the condition has length > 1 and only the first element will be used

到您应用的build.gradle文件,否则Crashlytics将无法解决并发出奇怪的错误。