错误:解析后无法更改配置':app:_debugAnnotationProcessor'的依赖关系

Ama*_*ain 15 android gradle build.gradle android-gradle-plugin android-kenburnsview

Gradle项目刷新失败

在我将KenBurnsView库添加到build.gradle应用程序级别之后.当我尝试同步gradle时,它失败了.

build.gradle(app level)

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
    applicationId "com.sample.ac"
    minSdkVersion 16
    targetSdkVersion 24
    versionCode 1
    versionName "1.0_dev"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    jackOptions {
        enabled true
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

repositories {
    jcenter()
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'

//ButterKnife for view injector
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

// EventBus for passing data between activities and fragments
compile 'org.greenrobot:eventbus:3.0.0'

//Material Loading Circular Progress Bar with white background
compile 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'

//GSON for parsing JSON into Java Object and vice versa
compile 'com.google.code.gson:gson:2.6.2'

//For Image Loading from network
compile 'com.github.bumptech.glide:glide:3.7.0'

//SLiding up Panel Layout for Music Player
compile 'com.sothree.slidinguppanel:library:3.3.0'

//For Network Calling
compile 'com.mcxiaoke.volley:library:1.0.19'

//ViewPagerIndicator
compile 'com.romandanylyk:pageindicatorview:0.0.7'

//Google Play Services
compile 'com.google.android.gms:play-services-auth:10.0.0'
compile 'com.google.android.gms:play-services-plus:10.0.0'
compile 'com.google.android.gms:play-services-identity:10.0.0'
compile 'com.google.android.gms:play-services-base:10.0.0'
compile 'com.google.android.gms:play-services-location:10.0.0'
compile 'com.google.android.gms:play-services-maps:10.0.0'
compile 'com.google.android.gms:play-services-gcm:10.0.0'

//Ken Burns Effect for Image Background
compile 'com.flaviofaria:kenburnsview:1.0.7'

//Material Search View
// compile 'com.miguelcatalan:materialsearchview:1.4.0'
compile project(':searchlibrary')

testCompile 'junit:junit:4.12'

}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

build.gradle(项目级别)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.2'
    classpath 'com.google.gms:google-services:3.0.0'

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

allprojects {
repositories {
    jcenter()
    mavenCentral()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

kda*_*awg 44

我在尝试为Android培训课程添加"com.android.support.constraint:constraint-layout:1.0.0-beta4"的依赖项时得到了它.

我设法克服了它,确实涉及杰克,因为@Scott怀疑.

过了它:

  1. 注释掉添加的依赖项,jackOptions启用true块,以及compileOptions块,我将它与1.8兼容.
  2. 同步/清洁/重建Gradle(无论哪个,我还在学习)
  3. 取消注释添加的依赖项,再次同步/重建gradle
  4. 取消注释jackOptions和compileOptions块,再次同步/重建gradle

那时,它对我有用.

  • 我能够通过从应用程序级Gradle文件中删除jackOptions和compileOptions来解决问题,同步/构建然后重新添加并同步/构建.杰克确实提供了一些很好的功能,但我已经厌倦了它的气质特别是像Dagger 2这样的库(我已经包含了完整的Guava库,否则我在编译时会收到NoMethodFound错误). (4认同)

小智 6

将其添加到应用程序build.gradle或项目build.module中:

repositories {
    maven {
        url 'https://maven.google.com'
    }
}
Run Code Online (Sandbox Code Playgroud)

当我添加'constraint-layout'依赖项时,我会遇到此问题,我在正式手册中找到了答案:https : //developer.android.com/training/constraint-layout/index.html 我认为这会为您提供帮助!