10

Gradle Project Refresh Failed错误:无法更改配置的依赖关系“:应用程序:_debugAnnotationProcessor”它已经解决了

后之后,我加入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 
} 
+0

您是否找到解决方案? –

+0

不是。你面临同样的问题吗? –

+1

我收到相同的错误信息,但试图添加不同的库时,我认为这是与杰克 –

回答

41

我尝试添加依赖关系时,得到它“com.android .support.constraint:constraint-layout:1.0.0-beta4“for a android training class。

我设法克服了它,它确实涉及Jack,因为@Scott被怀疑。

了过去,它由:

  1. 注释掉添加依赖关系中,jackOptions实现真正的块,和compileOptions块,在那里我有它与1.8兼容。
  2. 同步/清洁/重建摇篮(无论它是,我仍然在学习)
  3. 取消对添加的依赖,同步/重建gradle这个再次
  4. 取消对jackOptions和compileOptions块,同步/重建gradle这个再次

在这一点上,它为我工作。

+0

感谢的人。有效。你能告诉我这是如何工作的吗? –

+0

不幸的是,我不能说。我不熟悉幕后发生的事情。 – kdawg

+3

我能够通过简单地从应用程序级Gradle文件中删除jackOptions和compileOptions来解决问题,同步/构建然后重新加入并同步/构建。杰克确实提供了一些很好的功能,但我厌倦了这种情绪,尤其是像Dagger 2这样的图书馆(我已经包括了完整的番石榴图书馆,否则编译时会收到NoMethodFound错误)。 –

0

我也遇到过这个问题,我在存储库{...}中添加了maven,并在模块的build.gradle的依赖关系{...}中添加了一个依赖项。

我找到原因,因为Android Studio无法从Maven存储库加载依赖关系。然后改为编译,我将jar复制到模块,同步,错误消失。

总之,您可以在“C:\ Users \ wjj.gradle \ caches \ modules-2 \ files-2.1”中检查依赖项是否已加载。

我希望它能帮助你!

相关问题