android - 错误 :Cannot change dependencies of configuration ':app:_debugAnnotationProcessor' after it has been resolved

标签 android gradle android-gradle-plugin build.gradle android-kenburnsview

Gradle Project Refresh Failed

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

build.gradle(应用级别)

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'

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
}

最佳答案

我在尝试为 android 培训类(class)添加对“com.android.support.constraint:constraint-layout:1.0.0-beta4”的依赖项时得到了它。

正如@Scott 所怀疑的那样,我设法通过了它,它确实涉及到 Jack。

通过它:

  1. 注释掉添加的依赖项、jackOptions enable true block 和 compileOptions block ,我让它与 1.8 兼容。
  2. Sync/Clean/Rebuild Gradle(不管是哪个,我还在学习)
  3. 取消注释添加的依赖项,再次同步/重建gradle
  4. 取消注释 jackOptions 和 compileOptions block ,再次同步/重建 gradle

那时,它对我有用。

关于android - 错误 :Cannot change dependencies of configuration ':app:_debugAnnotationProcessor' after it has been resolved,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40809810/

相关文章:

android - Xamarin.Forms如何显示互联网连接状态?

java - 我的 Recycler View 的 Adapter 类中的 OnTouch 和 onClick 事件出现问题

java - Android 5.x ClassNotFoundException 在 6.0+ 上运行良好

Android Gradle 同步 "Tag Mismatch!"错误

android - 找不到 Gradle DSL 方法'compile()

java - 如何在多个 Activity 中传递字符串

java - 这个同步有什么意义?

maven - Gradle 替代 maven <packaging>pom

android - google-services 插件无法检测到 com.google.android.gms 或 com.google.firebase 的任何版本 - 奇怪的行为

android - AAPT2 编译失败 : invalid dimen on Android 3. 0 Canary 1