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」中檢查依賴項是否已加載。

我希望它能幫助你!

相關問題